Post

Replies

Boosts

Views

Activity

@Observable and other SwiftUI Macros
The sessions showing off the new SwiftUI macros are missing a key element.... How are they enabled within XCODE?!??!? For instance the session "Discover Observation in SwiftUI" starts with the code block. @Observable class FoodTruckModel { var orders: [Order] = [] var donuts = Donut.all } Well.... Something is missing here! I'm sure it's that I need to import something.... but for an intro session it MIGHT be important to mention what needs to be imported and any other requirements. Because right now all I'm getting is "Unknown attribute 'Observable'" So far this is a VERY disappointing WWDC. I got all excited about VisionOS... Nope, all the SDK isn't being release for a month. Reality Composer Pro... Not out yet. SwiftUI macros... Sure let's dive right in to step 6 and not tell you what you need to get started with this feature.
4
4
3.1k
Jun ’23
NavigationView with List will randomly change font to bold
Using Xcode 12.3 beta. using the following...         NavigationView {   List { Section(header: Text("Blaa Blaa").fontWeight(.bold)) { ForEach(0 ..< 9) { number in HStack { Button("Left Row \(number)") { // set values here   } Spacer() Text("Center Row \(number)")                         Spacer() Text("Right Row \(number)") } } .foregroundColor(Color.white) .shadow(color: Color.black.opacity(0.4), radius: 2, x: 4, y: 4) } } .listRowBackground(Color.gray) Then repeat to create 4 sections.... What will happen when redered as views is line items will RANDOMLY change the font to a bold typeface. This happens when scrolling or if this View is the target on a NavigationLink the open/close section arrows will cause items to redraw using bold font. I did find a "fix" if you add   .font(.body) to the HStack within the ForEach the problem goes away. Stephen.
0
0
434
Aug ’20