36/100 100 Days of SwiftUI – Day 36 – Hacking with Swift 東西越來越多 做點紀錄好了 學到 class 如何像 struct 一樣變更 使用@ ObseredObject 代替 @ State 使用sheet,sheet像 alert 一樣使用一個bool當作開關,把另一個view開起來, 使用@ Environment(\.presentationMode)得到現在這個veiw是否正在顯示,可以用它來把自己關閉,明天繼續 36
37/100 100 Days of SwiftUI – Day 37 – Hacking with Swift 複習使用class 使用 ObservableObject protocol,property使用@ Published 使用@ ObservedObject 宣告 ObservableObject物件 使得View裡面變更的Published的property 會跟著變更 認識ForEach裡面使用的id:\.xxx,代表xxx是唯一的可辨別的,而如果struct符合Identifiable protocol ,就可以免去使用id:\.xxx因為他已經是可以辨識每個成員的狀態,符合Identifiable protocol 必須要實作id property,id可以使用UUID()來製作,明天繼續37
100 Days of SwiftUI – Hacking with Swift
100 Days of SwiftUI – Day 2 – Hacking with Swift
100 Days of SwiftUI – Day 3 – Hacking with Swift
100 Days of SwiftUI – Day 4 – Hacking with Swift
100 Days of SwiftUI – Day 5 – Hacking with Swift
100 Days of SwiftUI – Day 6 – Hacking with Swift
100 Days of SwiftUI – Day 7 – Hacking with Swift
100 Days of SwiftUI – Day 8 – Hacking with Swift
100 Days of SwiftUI – Day 9 – Hacking with Swift
100 Days of SwiftUI – Day 10 – Hacking with Swift
100 Days of SwiftUI – Day 11 – Hacking with Swift
100 Days of SwiftUI – Day 12 – Hacking with Swift
100 Days of SwiftUI – Day 13 – Hacking with Swift
100 Days of SwiftUI – Day 14 – Hacking with Swift
100 Days of SwiftUI – Day 15 – Hacking with Swift
100 Days of SwiftUI – Day 16 – Hacking with Swift
100 Days of SwiftUI – Day 17 – Hacking with Swift
100 Days of SwiftUI – Day 18 – Hacking with Swift
100 Days of SwiftUI – Day 19 – Hacking with Swift
100 Days of SwiftUI – Day 20 – Hacking with Swift
100 Days of SwiftUI – Day 21 – Hacking with Swift
100 Days of SwiftUI – Day 22 – Hacking with Swift
100 Days of SwiftUI – Day 23 – Hacking with Swift
100 Days of SwiftUI – Day 24 – Hacking with Swift
100 Days of SwiftUI – Day 25 – Hacking with Swift
100 Days of SwiftUI – Day 26 – Hacking with Swift
100 Days of SwiftUI – Day 27 – Hacking with Swift
100 Days of SwiftUI – Day 28 – Hacking with Swift
100 Days of SwiftUI – Day 29 – Hacking with Swift
100 Days of SwiftUI – Day 30 – Hacking with Swift
100 Days of SwiftUI – Day 31 – Hacking with Swift
100 Days of SwiftUI – Day 32 – Hacking with Swift
100 Days of SwiftUI – Day 33 – Hacking with Swift
100 Days of SwiftUI – Day 34 – Hacking with Swift
100 Days of SwiftUI – Day 35 – Hacking with Swift
100 Days of SwiftUI – Day 36 – Hacking with Swift
東西越來越多 做點紀錄好了
學到 class 如何像 struct 一樣變更 使用@ ObseredObject 代替 @ State
使用sheet,sheet像 alert 一樣使用一個bool當作開關,把另一個view開起來,
使用@ Environment(\.presentationMode)得到現在這個veiw是否正在顯示,可以用它來把自己關閉,明天繼續 36
使用onDelete 把ForEach裡的物件刪除,也可以在NavigationView加上EditButton,也可以使列表裡的東西刪除
UserDefault可以儲存少量的資料,像Unity的PlayerPrefs一樣,儲存取出時都需要一個Key來做存取
Codable讓struct資料封裝成Json, xml等,用以傳輸或著用UserDefault存起來
100 Days of SwiftUI – Day 37 – Hacking with Swift
複習使用class 使用 ObservableObject protocol,property使用@ Published
使用@ ObservedObject 宣告 ObservableObject物件 使得View裡面變更的Published的property 會跟著變更
認識ForEach裡面使用的id:\.xxx,代表xxx是唯一的可辨別的,而如果struct符合Identifiable protocol ,就可以免去使用id:\.xxx因為他已經是可以辨識每個成員的狀態,符合Identifiable protocol 必須要實作id property,id可以使用UUID()來製作,明天繼續37