Tuesday, June 25, 2024
HomeIOS Developmentios - Navigating to view with Common Hyperlink?

ios – Navigating to view with Common Hyperlink?


Right here is how I am at the moment dealing with Common Hyperlinks:

@principal
struct MyApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    
    @StateObject var dataManager = DataManager()

    var physique: some Scene {
        WindowGroup {
            MainView()
                .environmentObject(dataManager)
                .onOpenURL { url in
                    handleIncomingURL(url: url)
                }
        }
    }
    
    non-public func handleIncomingURL(url: URL) {
        print(url)
        
        let elements = url.pathComponents
        let path = elements[1]
        
        if (path == "share") {
            // How do I navigate to my ProfileView() right here?
        }
    }
}

How can I navigate to my ProfileView() within the code above? Usually I’d simply do one thing like:

NavigationLink(vacation spot: ProfileView()) {

However I can not actually do this right here?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments