iOS (Swift)
In Swift apps, use the onOpenURL modifier to capture and handle incoming URLs.
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL { url in
print("URL: \(url)")
}
}
}
}
This method is called automatically when the user opens your app via dynalink. More info on how to set up deep links can be found in the Apple documentation.
Android (Kotlin / Java)
On Android, you can retrieve the incoming URL through the Intent that launched the activity.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
val action: String? = intent?.action
val data: Uri? = intent?.data
}