[英]Tabbar iPad App to Sidebar macOS Catalyst app
你可以做這樣的事情
#if targetEnvironment(macCatalyst)
// here use the NavigationView + NavigationLinks to make the sidebar on macOS
#else
// here use the Tab Bar view.
#endif
如果需要,您可以使用它來創建整個備用視圖。
例如:
#if targetEnvironment(macCatalyst)
struct MyView: View {
var body: some View {
Text("Im in macOS")
}
}
#else
struct MyView: View {
var body: some View {
Text("Im in iOS")
}
}
#endif
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.