Skip to content

Commit 7028879

Browse files
committed
WIP
1 parent 53a93cf commit 7028879

File tree

2 files changed

+18
-34
lines changed

2 files changed

+18
-34
lines changed

Examples/Showcase/Showcase/App.swift

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
import SwiftUI
22

3-
#if os(iOS) || os(tvOS)
4-
@main
5-
final class AppDelegate: UIResponder, UIApplicationDelegate {
6-
7-
var window: UIWindow?
8-
9-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
10-
window = UIWindow(frame: UIScreen.main.bounds)
11-
window?.rootViewController = UIHostingController(rootView: AppView())
12-
window?.makeKeyAndVisible()
13-
return true
14-
}
15-
}
16-
#elseif os(macOS) || os(visionOS)
173
@main
184
struct App: SwiftUI.App {
195
var body: some Scene {
206
WindowGroup {
21-
AppView()
7+
AppView().preferredColorScheme(.light)
228
}
239
}
2410
}
25-
#endif
2611

2712
#Preview {
2813
AppView()

Examples/Showcase/Showcase/AppView.swift

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,43 @@ struct AppView: View {
2020
}
2121

2222
struct ContentView: View {
23-
@State var selection = 0
24-
2523
var body: some View {
26-
TabView(selection: $selection) {
24+
TabView {
2725
ListShowcase()
28-
.tabItem { Text("List") }
29-
.tag(0)
26+
.tabItem { Label("List", systemImage: "1.circle") }
3027
ScrollViewShowcase()
31-
.tabItem { Text("ScrollView") }
32-
.tag(1)
28+
.tabItem { Label("ScrollView", systemImage: "2.circle") }
3329
#if !os(macOS)
3430
NavigationShowcase()
35-
.tabItem { Text("Navigation") }
36-
.tag(2)
31+
.tabItem { Label("Navigation", systemImage: "3.circle") }
3732
PresentationShowcase()
38-
.tabItem { Text("Presentation") }
39-
.tag(3)
33+
.tabItem { Label("Presentation", systemImage: "4.circle") }
4034
#endif
4135
ControlsShowcase()
42-
.tabItem { Text("Controls") }
43-
.tag(4)
36+
.tabItem { Label("Controls", systemImage: "5.circle") }
4437
UIViewRepresentableShowcase()
45-
.tabItem { Text("UIViewRepresentables") }
46-
.tag(5)
38+
.tabItem { Label("UIViewRepresentables", systemImage: "6.circle") }
4739
}
4840
#if os(iOS) || os(tvOS)
4941
.introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { tabBarController in
50-
tabBarController.tabBar.layer.backgroundColor = UIColor.green.cgColor
42+
if #available(iOS 26, macOS 26, tvOS 26, *) {
43+
tabBarController.tabBar.backgroundColor = .green
44+
} else {
45+
let appearance = UITabBarAppearance()
46+
appearance.configureWithOpaqueBackground()
47+
appearance.backgroundColor = .green
48+
tabBarController.tabBar.standardAppearance = appearance
49+
tabBarController.tabBar.scrollEdgeAppearance = appearance
50+
}
5151
}
5252
#elseif os(macOS)
5353
.introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { splitView in
5454
splitView.subviews.first?.layer?.backgroundColor = NSColor.green.cgColor
5555
}
5656
#endif
57-
.preferredColorScheme(.light)
5857
}
5958
}
6059

6160
#Preview {
62-
ContentView()
61+
AppView().preferredColorScheme(.light)
6362
}

0 commit comments

Comments
 (0)