简体   繁体   English

WatchOS 上的 SwiftUI - 用于启动活动或锻炼应用程序的代码?

[英]SwiftUI on WatchOS - code for launching Activity or Workout App?

I have a SwiftUI app in which I would like to show the "WorkOut" and "Activity" icons and launch those apps when the respective icon is tapped.我有一个 SwiftUI 应用程序,我想在其中显示“锻炼”和“活动”图标,并在点击相应图标时启动这些应用程序。

Is this possible in WatchOS6 & SwiftUI?这在 WatchOS6 和 SwiftUI 中可能吗?

I know this "can I launch another app from within my app" question has been asked before for iOS or WatchOS but the answers seem old and I was hoping that this is now possible in WatchOS 6.我知道这个“我可以从我的应用程序中启动另一个应用程序吗”的问题之前曾被问到 iOS 或 WatchOS,但答案似乎很旧,我希望现在可以在 WatchOS 6 中实现。

Thanks!谢谢!

Gerard杰拉德

MKMapItem has a method openInMaps() that you can use to open the Maps app. MKMapItem有一个openInMaps()方法,您可以使用它来打开地图应用程序。

I don't think there is an equivalent for the Workout/Activity apps.我认为锻炼/活动应用程序没有等效项。

Also, I seems like using their icons is against the guidelines.另外,我似乎使用他们的图标违反了指导方针。 You can only use the rings.您只能使用戒指。

https://developer.apple.com/design/human-interface-guidelines/healthkit/overview/ https://developer.apple.com/design/human-interface-guidelines/healthkit/overview/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM