Post

Replies

Boosts

Views

Activity

Reply to "IOSurface creation failed" drawing to CGContext
The source images are different sizes. I'm drawing them to a CGRect that scales them down to a common width and a height that maintains the aspect ration of the image I'm drawing in. (For context, I'm basically creating a web sprite of very low-resolution copies of the input images all stacked on top of each other. I'm getting the result I want, just would like to resolve this error)
Jan ’24
Reply to Problems when using @Binding on a dynamic array to edit a list (and the items it contains)
OK, I've made the following changes, and (so far) it seems to be working... (Can you confirm this is what you were suggesting?) struct NavView: View { @Binding var main: Main @State private var selection: UUID? var body: some View { NavigationSplitView { ListView(main: $main, selection: $selection) } detail: { if let selection { DetailView(detail: $main.details.first(where: { $0.id == selection })!) } else { Text("Select a detail item to view") } } } } struct ListView: View { @Binding var main: Main @State private var addedDetailCount = 0 @Binding var selection: UUID? var body: some View { List($main.details, editActions: .move, selection: $selection) { $detail in NavigationLink(detail.title, value: detail) } .toolbar { Button( LocalizedStringKey("Add Detail"), systemImage: "plus" ) { addedDetailCount += 1 main.details.append( .init(title: "new Detail \(addedDetailCount)", description: "description")) } } } }
1w