CS193p 2021

@bob-cs193p-note

Public team

Joined on Feb 15, 2022

  • L130min 2/15 :heavy_check_mark: 30min 2/16 :heavy_check_mark: 22min 2/17 :heavy_check_mark: L2 30min 2/17 :heavy_check_mark: 30min 2/19 :heavy_check_mark: 25min 2/20 :heavy_check_mark:
     Like  Bookmark
  • 13: Publisher, CloudKit, CoreData 14: App Architecture, Document Architecture, Undo Publisher // fetch the url backgroundImageFetchStatus = .fetching DispatchQueue.global(qos: .userInitiated).async { let imageData = try? Data(contentsOf: url)
     Like  Bookmark
  • cs193p Lecture 13: Publisher More Persistence publishers more persistence cloudKit coredata
     Like  Bookmark
  • 0:44 error handling 請自行翻書 swift-book/ErrorHandling 9:59 persistence FileManager (filesystem) CoreData (SQL database) CloudKit (database in the cloud) UserDefault (lightweight data)
     Like  Bookmark
  • 5:35 RangeReplaceableCollection 因為 Collection 是 immutable,所以改成 RangeReplaceableCollection 6:16 subscripting cards[card].isFaceUp = true If no card with the card.id exists in cards, then this does nothing. 8:51 Color / UIColor / CGColor
     Like  Bookmark
  • summary animation how does it work? viewModifier what exactly are functions like foregroundColor, font, padding, etc. doing?
     Like  Bookmark
  • 00:34 shuffle button // view model 新增一個 intent function func shuffle() { model.shuffle() } // model 對應,且在初始化時也打亂 mutating func shuffle() { cards.shuffle() }
     Like  Bookmark
  • Demo code at cs193p.stanford.edu summary @State Access Control Computed Properties Extensions Property Observers Layout @ViewBuilder
     Like  Bookmark
  • Demo code at cs193p.stanford.edu Architecture MVVM - use ViewModel to bind the view to model protocol Identifiable Struct's mutating function behide protcol ObserableObject type Enum 02:56 build a ViewModel
     Like  Bookmark
  •  Building Layouts with Stack Views If your layout has one dominant view that defines the size of the layout, use the overlay(_:alignment:) or background(_:alignment:) view modifier on that view. If you want the final view size to come from an aggregation of all the contained views, use a ZStack.  Making Fine Adjustments to a View’s Position the offset(x:y:) modifier uses the parameters of x and y to represent a relative location within the view’s coordinate space. ZStack 沒有指定 alignment,所以 Image 會在正中間(80,80)。 .offset(x: 40.0, y: -40.0) 加上這個偏移的話,就會坐落在第一象限。
     Like  Bookmark
  • 26:18 a lot of people when they first started learning SwiftUI, they think, "oh, that makes this writeable somehow, that now this View is mutable. It's got this variable to be writable." But that's not true. This View is still immutbale. It just turn this variable instead of really being a Boolean, it's actually a pointer to some Bollean somewhere else, somewhere in memory. And that's where the value can change. But this pointer does not change. It's always pointing to that same little space over there. 45:23 如果是寫這樣的話,點擊 🚆 會有兩個都被響應。
     Like  Bookmark