diff options
author | Vitaly Takmazov | 2024-05-15 08:39:35 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-05-15 08:39:35 +0300 |
commit | 1b058af687bac9dfe8c78209fe7ba510b2d78257 (patch) | |
tree | 5bba49c4f8947f9e2c5e8cbe56bf95c8e14e2aba /JuickNext | |
parent | 42380d544f26b9530ae1065809f3657b0eca6b20 (diff) |
JuickNext: conditional layout for big screens
Diffstat (limited to 'JuickNext')
-rw-r--r-- | JuickNext/View/ContentView.swift | 15 | ||||
-rw-r--r-- | JuickNext/View/Discussions.swift (renamed from JuickNext/View/DiscussionsView.swift) | 10 | ||||
-rw-r--r-- | JuickNext/View/Today.swift | 5 |
3 files changed, 21 insertions, 9 deletions
diff --git a/JuickNext/View/ContentView.swift b/JuickNext/View/ContentView.swift index 03916fc..e77d6e7 100644 --- a/JuickNext/View/ContentView.swift +++ b/JuickNext/View/ContentView.swift @@ -9,17 +9,26 @@ import SwiftUI struct ContentView: View { + @Environment(\.horizontalSizeClass) private var size var body: some View { - TabView { + let view = (size == .compact) ? + AnyView(TabView { Today() .tabItem { Image("ei-clock") } - Text("Discussions") + Discussions() .tabItem { Image("ei-bell") } - } + }): AnyView(NavigationView { + VStack { + Text("Discussions") + Text("Discover") + Text("Chats") + } + }) + view } } diff --git a/JuickNext/View/DiscussionsView.swift b/JuickNext/View/Discussions.swift index b8f121b..20e7fa8 100644 --- a/JuickNext/View/DiscussionsView.swift +++ b/JuickNext/View/Discussions.swift @@ -1,5 +1,5 @@ // -// DiscussionsView.swift +// Discussions.swift // Juick // // Created by Vitaly Takmazov on 14.05.2023. @@ -8,14 +8,14 @@ import SwiftUI -struct DiscussionsView: View { +struct Discussions: View { var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + Text("Discussions") } } -struct DiscussionsView_Previews: PreviewProvider { +struct Discussions_Previews: PreviewProvider { static var previews: some View { - DiscussionsView() + Discussions() } } diff --git a/JuickNext/View/Today.swift b/JuickNext/View/Today.swift index aa4a205..161a353 100644 --- a/JuickNext/View/Today.swift +++ b/JuickNext/View/Today.swift @@ -9,8 +9,11 @@ import SwiftUI struct Today: View { + let title = "Today" var body: some View { - Text("Today") + NavigationView { + Text(title) + } } } |