This iOS demo app shows how to use Bitly short links and custom domains to trigger universal link behavior in a mobile app. Itβs meant for developers who want to understand how Bitly deep linking works with Appleβs native system.
- How to register a Bitly custom domain (e.g.
b.yourdomain.com) for mobile deep linking - How to open your iOS app from a Bitly link like:
https://b.yourdomain.com/profile - How to route based on URL path (e.g.,
/profile,/settings) - How to integrate Appleβs Universal Links via
Associated Domains
git clone https://github.com/yourusername/BitlyUniversalLinkExample.git
cd BitlyUniversalLinkExampleThis repo contains the Swift source files β you'll create a new Xcode project to import them:
- Open Xcode and create a new iOS App project named
BitlyUniversalLinkExample - Use Swift and UIKit
- Replace the generated
AppDelegate.swift,main.swift, andInfo.plistwith the ones in this repo
In your new Xcode project:
- Go to the app target β Signing & Capabilities
- Set your Apple Developer Team
- Update the Bundle Identifier to something unique, e.g.:
com.yourcompany.bitlydemo
Still under Signing & Capabilities:
- Click + Capability
- Add Associated Domains
- Add your Bitly custom domain:
applinks:b.yourdomain.com
Replace
b.yourdomain.comwith your verified Bitly deep linking subdomain. Bitly will automatically serve theapple-app-site-associationfile from this domain.
- Connect a physical iPhone (Universal Links do not work in the simulator)
- Build and run the app from Xcode
- Tap a Bitly short link (e.g.,
https://b.yourdomain.com/profile) in Safari or Notes - The app should launch and log routing info to the Xcode console
The app inspects the incoming universal link path and logs a message accordingly:
switch url.path {
case "/profile": print("β Profile Screen")
case "/settings": print("β Settings Screen")
default: print("β Home or fallback")
}You can swap these out with actual view controller navigation in your real app.
In Bitly, create a new short link:
- Domain:
b.yourdomain.com - Long URL: Can be any valid URL (e.g.,
https://example.com) - Final short link:
https://b.yourdomain.com/profile
This triggers routing to the βProfileβ section of your app.
- This demo uses Universal Links, not custom URL schemes
- Bitly must be configured with your custom domain
- No App Store publishing is required β use Xcode or TestFlight
MIT β use freely for testing, demos, or production bootstrapping.