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 numberString: String = "" | |
| @State var showingAlert: Bool = false | |
| @State var showingSheet: Bool = false | |
| var body: some View { | |
| VStack { | |
| TextField("Input Number", text: $numberString) |
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 isActive: Bool = false | |
| var body: some View { | |
| NavigationStack { | |
| VStack { | |
| Button(action: { | |
| isActive = 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 { | |
| private let aliceInWonderland = "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, “and what is the use of a book,” thought Alice “without pictures or conversations?”\nSo she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her.\nThere was nothing so very remarkable in that; nor did Alice think it so very much out of the way to hear the Rabbit say to itself, “Oh dear! Oh dear! I shall be late!” (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually took a w |
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 { | |
| VStack { | |
| Text("I") | |
| .font(.system(size: 20).bold()) | |
| + Text(" ❤️ ") | |
| .foregroundStyle(Color.red) | |
| + Text("Snorlax") |
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 CardView<Content>: View where Content: View { | |
| let color: Color | |
| let radius: CGFloat | |
| let content: () -> Content | |
| init( | |
| color: Color = Color.gray.opacity(0.4), | |
| radius: CGFloat = 8, |
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 CardViewModifier: ViewModifier { | |
| let color: Color | |
| let radius: CGFloat | |
| func body(content: Content) -> some View { | |
| content | |
| .padding(16) | |
| .background(Color.white) | |
| .cornerRadius(16) |
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 private var users = ["Paul", "Taylor", "Adele"] | |
| var body: some View { | |
| NavigationView { | |
| List { | |
| ForEach(users, id: \.self) { user in | |
| Text(user) |
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 showingAlert = false | |
| @State var pokemon: Pokemon? | |
| let pokemons: [Pokemon] = [ | |
| Pokemon(id: 143, name: "Snorlax"), | |
| Pokemon(id: 25, name: "Pikachu"), | |
| Pokemon(id: 138, name: "Psyduck"), |
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, MyProtocol { | |
| @State var text: String = "My Text" | |
| var body: some View { | |
| NavigationView { | |
| VStack { | |
| Text(text) | |
| NavigationLink(destination: SecondView(delegate: self)) { | |
| Text("2nd 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 pokemon: Pokemon? | |
| var body: some View { | |
| NavigationStack { | |
| List (Pokemon.allCases) { pokemon in | |
| Button { | |
| self.pokemon = pokemon | |
| } label: { |