Swift implementation

Example: Swift Playground project


  1. If you don't already have Swift Playground (free Mac app to build iOS apps), download it here.
  2. Download the Swift Playground Sample App folder: Swift Playground Sample App - Google Drive link
  3. Unzip the downloaded folder, open in Swift Playground.
  4. You will see the Acme Inc widget in the App Preview, as seen in the preview image above.
  5. In the ContentView file, locate the EmbeddedLinkConfig setup on line 30.
    1. Replace publicAlias with 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.
    2. Optionally use consentToken if 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.
    3. Optionally use pullMetaData to associate Pulls with your app's end users. pullMetadata is returned in the GET /pulls/:pullId API endpoint

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 ...