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
/* Data Model & Arrray Example */ | |
struct Contact: Identifiable, Hashable { | |
let id = UUID() | |
let firstName: String | |
let lastName: String | |
let shortName: String | |
let role: String | |
let phone: 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
var body: some View { | |
VStack(spacing: 10) { | |
Text("HStack") | |
.font(.title) | |
Text("Spacing & Alignment") | |
.font(.subheadline) | |
HStack { | |
Circle() |
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
struct ContentView: View { | |
@AppStorage("username") var username: String = "guest" | |
var body: some View { | |
VStack { | |
Text("Welcome, \(username)!") | |
TextField("Enter your username", text: $username) | |
} | |
} | |
} |
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 private var favoriteFruit = 1 | |
var body: some View { | |
VStack(spacing: 20) { | |
Text("SwiftUI Picker") | |
.font(.largeTitle) |
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 Pet: Identifiable, Hashable { | |
let id = UUID() | |
let name: String | |
} | |
struct PetCustomRow: View { | |
let pet: Pet |