Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct MyApp: App {
- var body: some Scene {
- WindowGroup {
- HomeView()
- }
- }
- }
- struct HomeView: View {
- @State var strings: [String] = ["\(Image(systemName: "sun.max.fill"))DART Meadow", "B", "C"]
- @State var selection: String?
- var body: some View {
- NavigationView {
- List(selection: $selection) {
- ForEach(strings, id: \.self) { string in
- Text(string)
- }
- }
- .listStyle(SidebarListStyle())
- VStack {
- Spacer()
- Text(selection ?? "<none>")
- .frame(idealWidth: 100, maxWidth: .infinity, alignment: .center)
- Spacer()
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement