This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| @State var selectedHour = 8 | |
| @State var selectedMinute = 30 | |
| var body: some View { | |
| GeometryReader { geometry in | |
| HStack { | |
| Picker(selection: $selectedHour, label: EmptyView()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| @State var showingCover = false | |
| var body: some View { | |
| VStack { | |
| Button(action: { | |
| showingCover = true | |
| }) { | |
| Text("Tap me!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| var body: some View { | |
| NavigationStack { | |
| Text("No Navigation Bar") | |
| .navigationBarTitle("Not Showing Title") | |
| .navigationBarHidden(true) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| var body: some View { | |
| Text("I Love Snorlax Forever!!") | |
| } | |
| } | |
| struct ContentView_Previews: PreviewProvider { | |
| static var previews: some View { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| @State var message = "Shake Me" | |
| var body: some View { | |
| Text(message) | |
| .onReceive(NotificationCenter.default.publisher(for: .deviceDidShakeNotification)) { _ in | |
| message = "Device Did Shake" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| let columns = [GridItem(.fixed(80)), GridItem(.fixed(80)), GridItem(.fixed(80)), GridItem(.fixed(80))] | |
| var body: some View { | |
| ScrollView { | |
| LazyVGrid(columns: columns) { | |
| ForEach(0..<100, id: \.self) { number in | |
| Text("\(number)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| var body: some View { | |
| TabView { | |
| ContentViewCell(image: Image(.snorlax)) | |
| ContentViewCell(image: Image(.magnemite)) | |
| ContentViewCell(image: Image(.psyduck)) | |
| ContentViewCell(image: Image(.quagsire)) | |
| ContentViewCell(image: Image(.slowpoke)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| @State var showingSheet = false | |
| var body: some View { | |
| Button(action: { | |
| showingSheet = true | |
| }, label: { | |
| Text("Show Modal!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| @State var viewType: ViewType = .launch | |
| var body: some View { | |
| ZStack { | |
| switch viewType { | |
| case .launch: | |
| Text("Launch") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| @State var showingSheet = false | |
| var body: some View { | |
| Button(action: { | |
| showingSheet = true | |
| }, label: { | |
| Text("Show Modal!") |