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
| var body: some View { | |
| NavigationView { | |
| List($colors){ $color in | |
| Text(color.name) | |
| } | |
| .refreshable { | |
| self.colors.append(Colors(name: "Newly added")) | |
| } | |
| .navigationTitle("Colors List") |
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 Colors : Identifiable{ | |
| var id = UUID() | |
| var name : String | |
| } | |
| struct SearchingLists: View { | |
| @State private var searchQuery: String = "" | |
| @State private var colors: [Colors] = [Colors(name: "blue"), |
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
| struct Colors : Identifiable{ | |
| var id = UUID() | |
| var name : String | |
| } | |
| struct SearchingLists: View { | |
| @State private var searchQuery: String = "" | |
| @State private var colors: [Colors] = [Colors(name: "Blue"),Colors(name: "Red"),Colors(name: "Green")] | |
| var body: 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
| Form{ | |
| TextField("Email", text: $field1) | |
| SecureField("Password", text: $field2) | |
| TextField("Name", text: $field3) | |
| .submitScope(false) //setting true won't submit the values | |
| } | |
| .onSubmit { | |
| print(field1) |
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
| enum CurrentField{ | |
| case field1 | |
| case field2 | |
| } | |
| struct TextFieldFocus: View { | |
| @State var field1 = "" | |
| @State var field2 = "" | |
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
| struct VLabelStyle: LabelStyle { | |
| func makeBody(configuration: Configuration) -> some View { | |
| VStack { | |
| configuration.icon | |
| configuration.title | |
| } | |
| } | |
| } |
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
| @main | |
| struct MyWidgetBundle: WidgetBundle { | |
| @WidgetBundleBuilder | |
| var body: some Widget { | |
| AnotherJokesWidget() | |
| JokesWidget() | |
| } | |
| } |
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
| struct JokesEntry: TimelineEntry { | |
| public let date: Date | |
| public let joke : String | |
| } |
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
| @main | |
| struct ProjectName: App { | |
| var body: some Scene { | |
| WindowGroup { | |
| ContentView() | |
| } | |
| } | |
| } |
NewerOlder