Ensure that the Native API is enabled to integrate Clerk in your native application. In the Clerk Dashboard, navigate to the Native Applications page.
To get started using Clerk with iOS, create a new project in Xcode. Select SwiftUI as your interface and Swift as your language.
See the Xcode documentation for more information.
Follow the Swift Package Manager instructions to install Clerk as a dependency.
When prompted for the package URL, enter https://github.com/clerk/clerk-ios. Be sure to add the package to your target.
To enable seamless authentication flows, you need to add an associated domain capability to your iOS app. This allows your app to work with Clerk's authentication services.
In Xcode, select your project in the Project Navigator.
Select your app target.
Navigate to the Signing & Capabilities tab.
Select the + Capability option.
Search for and add Associated Domains. It will be added as a dropdown to the Signing & Capabilities tab.
Under Associated Domains, add a new entry with the value: webcredentials:{YOUR_FRONTEND_API_URL}
Note
Replace {YOUR_FRONTEND_API_URL} with your Frontend API URL, which can be found on the Native Applications page in the Clerk Dashboard.
The updated ContentView uses two key Clerk components:
AuthView: A comprehensive authentication view that handles sign-in and sign-up flows, including email verification, password reset, and multi-factor authentication. It's presented as a sheet when the user taps "Sign in".
UserButtoniOS Icon: A circular button that displays the user's profile image. When tapped, it automatically presents the UserProfileViewiOS Icon where users can manage their account, update their profile, and sign out.