LocalAuthenticationKit
is a SwiftUI library for handling local authentication.
- iOS: 17.0 or later.
- macOS: 14.0 or later.
You can install LocalAuthenticationKit
using the Swift Package Manager.
- In Xcode, select "File" > "Add Package Dependencies".
- Copy & paste the following into the "Search or Enter Package URL" search bar.
https://github.com/JamesSedlacek/LocalAuthenticationKit.git
- Xcode will fetch the repository & the "LocalAuthenticationKit" library will be added to your project.
- Add
.authenticateIfEnabled()
to the root view in your project.
import LocalAuthenticationKit
import SwiftUI
@main
struct ExampleApp: App {
var body: some Scene {
ContentView()
.authenticateIfEnabled()
}
}
- Use a
LocalAuthToggle()
in the settings screen in your project.
import LocalAuthenticationKit
import SwiftUI
struct SettingsView {
var body: some View {
VStack {
LocalAuthToggle()
}
}
}