Skip to content

Commit

Permalink
Fix tvOS
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Sep 26, 2024
1 parent 415056e commit bbf032b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
48 changes: 23 additions & 25 deletions Sources/OversizeRouter/RoutingViews/RoutingSidebarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,33 @@ public struct RoutingSidebarView<Tab>: View where Tab: TabableView {
}

public var body: some View {
if #available(macOS 15.0, iOS 18.0, *) {
TabView(selection: $router.selection) {
ForEach(router.tabs) { tab in
tab.view()
.tag(tab)
.tabItem {
tab.icon
Text(tab.title)
}
.environment(router)
.environment(hudRouter)
}
}
#if os(iOS) || os(macOS) || os(tvOS) || os(visionOS)
if #available(iOS 18.0, macOS 15.0, tvOS 18.0, visionOS 2.0, *) {
tabView
.tabViewStyle(.sidebarAdaptable)
.hud(hudRouter.hudText, isPresented: $hudRouter.isShowHud)
} else {
TabView(selection: $router.selection) {
ForEach(router.tabs) { tab in
tab.view()
.tag(tab)
.tabItem {
tab.icon
Text(tab.title)
}
.environment(router)
.environment(hudRouter)
}
}
tabView
.hud(hudRouter.hudText, isPresented: $hudRouter.isShowHud)
}
#else

tabView
#endif
}

var tabView: some View {
TabView(selection: $router.selection) {
ForEach(router.tabs) { tab in
tab.view()
.tag(tab)
.tabItem {
tab.icon
Text(tab.title)
}
.environment(router)
.environment(hudRouter)
}
}
}
}
8 changes: 8 additions & 0 deletions Sources/OversizeRouter/RoutingViews/RoutingSplitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public struct RoutingSplitView<TopSidebar, BottomSidebar, Tab>: View where Tab:
}
}
.listStyle(.sidebar)
#elseif os(watchOS)
List {
ForEach(router.tabs) { menu in
NavigationLink(value: menu) {
Text(menu.title)
}
}
}
#else
List(selection: $router.selection) {
topSidebar
Expand Down

0 comments on commit bbf032b

Please sign in to comment.