|
1 |
| -# sdk-swift-ui |
| 1 | +# Trinsic Swift UI Library |
| 2 | + |
| 3 | +[](<[https://www.npmjs.org/package/@trinsic/react-native-ui](https://cocoapods.org/pods/TrinsicUI)>) [](https://github.com/trinsic-id/sdk/actions?query=branch%main) |
| 4 | + |
| 5 | +The Trinsic Swift UI Library provides ways to launch verification sessions directly in your Swift and Objective-C projects, requiring very little code. |
| 6 | + |
| 7 | +You can find a full example using this library in the [samples](https://github.com/trinsic-id/sdk/tree/main/ui-swift/samples) folder. |
| 8 | + |
| 9 | +## Documentation |
| 10 | + |
| 11 | +See the [Trinsic docs](https://docs.trinsic.id/docs/) for more detailed information on how to start integrating with our identity acceptance network. |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +### Swift package manager |
| 16 | + |
| 17 | +Add the Trinsic repository `https://github.com/trinsic-id/sdk-swift-ui` as a dependency. |
| 18 | + |
| 19 | +### CocoaPods |
| 20 | + |
| 21 | +Add a reference to the `TrinsicUI` pod to your `Podfile` with the latest version (see the shield at the top of the readme) and run `pod install` |
| 22 | + |
| 23 | +``` |
| 24 | +pod 'TrinsicUI', '~> [latest version]' |
| 25 | +``` |
| 26 | + |
| 27 | +## Setup |
| 28 | + |
| 29 | +### Choose a Custom Scheme |
| 30 | + |
| 31 | +This library makes use of `ASWebAuthenticationSession` on iOS and macOS. |
| 32 | + |
| 33 | +Therefore, you must register a custom scheme against your app on both iOS and macOS in order for the library to be able to capture the results of a session. |
| 34 | + |
| 35 | +This custom scheme **should be globally unique to your organization and application**. |
| 36 | + |
| 37 | +An example of a good custom scheme might be `acme-corp-shopping-app-trinsic`. |
| 38 | + |
| 39 | +#### Add the scheme to your app's URLs |
| 40 | + |
| 41 | +Select your app's target and on the info tab in XCode add the scheme you selected. |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +Import TrinsicUI into your view: |
| 46 | + |
| 47 | +```swift |
| 48 | +import TrinsicUI |
| 49 | +``` |
| 50 | + |
| 51 | +Create an instance of TrinsicUI and launch a session. |
| 52 | +You can retrieve the launch url from a trusted backend that can reach out to the Trinsic servers. [See our backend language examples](https://github.com/trinsic-id/sdk/tree/main/api-typescript/samples). |
| 53 | + |
| 54 | +```swift |
| 55 | +let trinsicUI = TrinsicUI() |
| 56 | +let result = try await trinsicUI.launchSession(launchUrl: "[REPLACE_ME]", callbackURL: "[REPLACE_ME]") |
| 57 | +``` |
| 58 | + |
| 59 | +## SDK Versioning |
| 60 | + |
| 61 | +var configuration = new Configuration { AccessToken = "your-access-token" }; |
| 62 | + |
| 63 | +var attachments = new AttachmentsApi(configuration); |
| 64 | +var network = new NetworkApi(configuration); |
| 65 | +var sessions = new SessionsApi(configuration); |
| 66 | + |
| 67 | +## Support |
| 68 | + |
| 69 | +Any issues, inquiries, and feature requests can be sent to [[email protected]](mailto:[email protected]), or feel free to open a GitHub issue [here ](https://github.com/trinsic-id/sdk/issues). |
| 70 | + |
| 71 | +## More Information |
| 72 | + |
| 73 | +- [API Reference](https://docs.trinsic.id/reference) |
| 74 | +- [Developer Guide](https://docs.trinsic.id/docs/developer-tools) |
| 75 | +- [Our Blog](https://trinsic.id/blog/) |
| 76 | +- [Schedule a demo](https://trinsic.id/contact/) |
0 commit comments