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 CalendarView: UIViewRepresentable { | |
| let didSelectDate: (_ dateComponents: DateComponents) -> Void | |
| final public class Coordinator: NSObject, UICalendarSelectionSingleDateDelegate { | |
| let didSelectDate: (_ dateComponents: DateComponents) -> Void | |
| init( | |
| didSelectDate: @escaping (_ dateComponents: DateComponents) -> Void |
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 { | |
| @StateObject var viewModel = ContentViewState() | |
| var body: some View { | |
| VStack { | |
| Button("Play") { | |
| viewModel.playAudio() | |
| } | |
| } |
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 name = "" | |
| @State var showingSheet = false | |
| var body: some View { | |
| VStack(spacing: 16) { | |
| TextField("Input Name", text: $name) | |
| .textFieldStyle(RoundedBorderTextFieldStyle()) |
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 height: String = "" | |
| @State var weight: String = "" | |
| @State var bmi: Double = 0 | |
| @State var showingSheet = false | |
| var body: some View { | |
| VStack { |
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 showingPopUp = false | |
| var body: some View { | |
| ZStack { | |
| Button(action: { | |
| withAnimation { | |
| showingPopUp = 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 { | |
| let pokemons = ["pikachu", "slowpoke", "bellsprout", "ditto", "snorlax", "eevee", "magikarp"] | |
| ScrollView(.horizontal, showsIndicators: false) { | |
| LazyHStack(spacing: 12) { | |
| ForEach(pokemons, id: \.self) { pokemon in | |
| Image(pokemon) |
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 enable: Bool = true | |
| var body: some View { | |
| VStack { | |
| Toggle(isOn: $enable) { | |
| Text("isEnable: \(enable.description)") | |
| } |
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 = "" | |
| var body: some View { | |
| TextField("Input Number", text: $numberString) | |
| .keyboardType(.decimalPad) | |
| .textFieldStyle(RoundedBorderTextFieldStyle()) | |
| .padding() |
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: Bool = false | |
| var body: some View { | |
| Button(action: { | |
| showingSheet = true | |
| }, label: { | |
| Text("ShowSheet") |
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 pokemons: [Pokemon] = [ | |
| Pokemon(id: 143, name: "Snorlax"), | |
| Pokemon(id: 52, name: "Meowth"), | |
| Pokemon(id: 25, name: "Pikachu") | |
| ] | |
| var body: some View { |