【问题标题】:Getting push notification details on app launch using swiftUI language使用 swiftUI 语言在应用启动时获取推送通知详细信息
【发布时间】:2019-12-26 17:09:43
【问题描述】:

我正在使用 SwiftUI 语言

我单击通知并重定向到主屏幕,但我需要重定向中的详细屏幕。

这是我设置的根代码..如何使用 SwiftUI 语言在此处设置详细屏幕

if(application.applicationState == .inactive)
    {
        // let storyboard = UIStoryboard(name: "Main", bundle: nil)

        let contentView = ContentView1()

        if let window = UIApplication.shared.keyWindow {

            self.window = window

        }

        self.window?.rootViewController =  UIHostingController(rootView: contentView)
        self.window?.makeKeyAndVisible()

        print("user tapped the notification bar when the app is in background")
    }

【问题讨论】:

    标签: swiftui swiftui-navigationlink


    【解决方案1】:

    您可以使用NavigationView 并在其中放入NavigationLink(_,destination:,tag:,selection:),其中selection 绑定到与收到的通知匹配的值。

    详细解释和示例代码见https://nalexn.github.io/swiftui-deep-linking/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-08
      • 1970-01-01
      • 1970-01-01
      • 2012-12-30
      相关资源
      最近更新 更多