Creating App Custom URL Scheme

We can do this by adding the following fields to the info plist:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
	<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeRole</key>
			<string>Viewer</string>
			<key>CFBundleURLName</key>
			<string>com.rderik.intoaccountapp</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>intoaccountapp</string>
			</array>
		</dict>
	</array>

Or by going to the project info and adding a new URL Type. Create new Custom URL Scheme

The scheme is the one you’ll use to reference the app. For example, when you want to open your app form a today extension, you will use a code similar to the following:

1
2
3
4
5
    @IBAction func openAppTapped(_ sender: Any) {
        if let url = URL(string: "yourappscheme://") {
            extensionContext?.open(url, completionHandler: nil)
        }
    }

** If you want to check what else I'm currently doing, be sure to follow me on twitter @rderik or subscribe to the newsletter. If you want to send me a direct message, you can send it to derik@rderik.com.
$