This file contains 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 { | |
VStack { | |
Button(action: { | |
showingSheet = true | |
}) { | |
Text("Tap me!") |
This file contains 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 pokemons: [Pokemon] = [ | |
Pokemon(name: "snorlax", type: "normal"), | |
Pokemon(name: "ditto", type: "normal"), | |
Pokemon(name: "psyduck", type: "water"), | |
Pokemon(name: "pikachu", type: "electric"), | |
] | |
This file contains 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 | |
public struct CameraView: UIViewControllerRepresentable { | |
@Environment(\.dismiss) private var dismiss | |
@Binding var images: [UIImage] | |
public func makeCoordinator() -> Coordinator { | |
Coordinator(self) | |
} |
This file contains 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 pokemons = ["Snorlax", "Pikachu", "Slowpoke", "Meowth"] | |
@State var selectedPokemon = 0 | |
var body: some View { | |
Picker("Pokemon", selection: $selectedPokemon) { | |
ForEach(pokemons, id: \.self) { pokemon in | |
Text(pokemon) |
This file contains 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 fruits = ["Apple", "Banana", "Orange", "Grape", "Cherry", "Peach"] | |
var body: some View { | |
NavigationView { | |
List(fruits, id: \.self) { fruit in | |
NavigationLink(destination: SecondView(fruit: fruit)) { | |
Text(fruit) |
This file contains 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 fruits = ["Apple", "Banana", "Orange", "Grape", "Cherry", "Peach"] | |
var body: some View { | |
NavigationView { | |
List(fruits, id: \.self) { fruit in | |
NavigationLink(destination: SecondView(fruit: fruit)) { | |
Text(fruit) |
This file contains 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 { | |
List { | |
Section("Normal") { | |
Text("Meowth") | |
Text("Ditto") | |
} |
This file contains 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 | |
var body: some View { | |
VStack { | |
Button { | |
showingAlert = true | |
} label: { |
This file contains 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 Foundation | |
struct AlertItem { | |
let buttonTitle: String | |
let message: String | |
} |
This file contains 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 bool = true | |
var body: some View { | |
VStack { | |
Text(bool ? "Snorlax" : "Forever") | |
Button(action: { | |
bool.toggle() |
NewerOlder