Example: Swift Playground project
- If you don't already have Swift Playground (free Mac app to build iOS apps), download it here.
- Download the Swift Playground Sample App folder: Swift Playground Sample App - Google Drive link
- Unzip the downloaded folder, open in Swift Playground.
- You will see the Acme Inc widget in the App Preview, as seen in the preview image above.
- In the ContentView file, locate the EmbeddedLinkConfig setup on line 30.
- Replace
publicAliaswith your link's public alias. Find your link's public alias from the Links page. If you know your Canopy Connect link URL, it's the fragment after /c/. For example, the publicAlias of https://app.usecanopy.com/c/demo is demo. - Optionally use
consentTokenif you're using your own custom consent screen & collecting consent in your app. It allows you to bypass our default consent screen, and end users can proceed directly to carrier selection. - Optionally use
pullMetaDatato associate Pulls with your app's end users.pullMetadatais returned in the GET /pulls/:pullId API endpoint
- Replace
Part to edit:
... lines 1 - 29 in ContentView ...
config: EmbeddedLinkConfig(
publicAlias: "demo", // replace with your widget's public alias
consentToken: "xxx", // Optional, use if you're collecting consent in your app and skipping our consent screen. Replace with a consent token retrieved from our Consent API.
hideCloseButton: true,
pullMetaData: ["custom-data-id": "123-456"] // optional, custom metadata to associate Pulls with your app's end users. pullMetadata is returned in the Pulls API.
),
... rest of ContentView ...