The monorepo for Logto SDKs written in Swift. Check out our docs for more information.
| Version | Branch | Status |
|---|---|---|
| v2 (beta) | master |
In development - released as 2.0.0-beta.x prereleases until GA |
| v1 (stable) | v1.x |
Maintenance - bug fixes only |
v2 moves the iOS sign-in experience from an embedded WebView to ASWebAuthenticationSession (the system browser), unlocks WebAuthn/passkeys and shared browser sessions, removes native social plugin targets, and revamps the sign-out API.
- Upgrading from v1? Follow MIGRATION.md.
- This README documents v2. The v1 documentation lives in the
v1.xREADME.
Since Xcode 11, you can directly import a swift package w/o any additional tool. Use the following URL to add Logto SDKs as a dependency:
https://github.com/logto-io/swift.gitv2 is in beta: use 2.0.0-beta.1 for the first beta, or the latest 2.0.0-beta.x prerelease when selecting a package version. For the stable v1 line, see Versions.
Carthage needs a xcodeproj file to build. We will try to find a workaround later.
CocoaPods does not support local dependency and monorepo, thus it's hard to create a .podspec for this repo.
| Name | Description |
|---|---|
| Logto | Logto swift core. |
| LogtoClient | Logto swift client. |
In most cases, you only need to import LogtoClient, which includes Logto under the hood.
signInWithBrowser(redirectUri:) supports both custom scheme redirect URIs and HTTPS Universal Links.
For a custom scheme such as io.logto.app://callback, register the scheme part (io.logto.app) in your app's Info.plist and add the full URI to your Logto application's Redirect URIs. This works with automatic ASWebAuthenticationSession completion on all supported iOS versions.
You can also use an HTTPS redirect URI such as https://example.com/callback:
- Add the Associated Domains capability to your app.
- Configure the domain as
webcredentials:example.comsoASWebAuthenticationSessioncan match HTTPS callbacks on iOS 17.4 and newer. - If the same URL should also open your app as a Universal Link outside the authentication session, configure
applinks:example.comand host a validapple-app-site-associationfile for the domain and path. - Add the HTTPS URI to your Logto application's Redirect URIs.
On iOS 17.4 and newer, the SDK uses ASWebAuthenticationSession's HTTPS callback matching API so HTTPS redirects can automatically complete and dismiss the session. On older iOS versions, the authorization request can still use the HTTPS redirect URI, but the session may not close automatically unless your app handles the Universal Link callback itself. Keep a custom scheme redirect as a compatibility option if you need automatic completion on older iOS versions.