Post

Replies

Boosts

Views

Activity

Reply to iOS 17b6: Simultaneous accesses to ..., but modification requires exclusive access crash using Observation and SwiftUI
Also, this seems to be specific to the list selection in the sidebar in NavigationSplitView as I'm using the same app model elsewhere in my project and everything works fine. I did have the same crash in another part of my project where I use a similar UI, which was also using the app model. In that particular case, I could remove the property from the app model, which solved the issue.
Aug ā€™23
Reply to iOS 17b6: Simultaneous accesses to ..., but modification requires exclusive access crash using Observation and SwiftUI
Why do you need a shared static property on AppModel? This is obviously just a demo project to demonstrate the issue. In my real project, that property has to be accessible from other parts of the app Since Folder conforms to identifiable in SidebarView could you just use ForEach(folders) { folder in? Doesn't make a difference. The crash output looks like this: @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar() internal nonisolated func access<Member>( keyPath: KeyPath<AppModel , Member> ) { _$observationRegistrar.access(self, keyPath: keyPath) } internal nonisolated func withMutation<Member, MutationResult>( keyPath: KeyPath<AppModel , Member>, _ mutation: () throws -> MutationResult ) rethrows -> MutationResult { try _$observationRegistrar.withMutation(of: self, keyPath: keyPath, mutation) --> Thread 1: Simultaneous accesses to 0x281bcc760, but modification requires exclusive access } @ObservationIgnored private var _selectedFolder: Folder? = nil
Aug ā€™23
Reply to Swift compiler crash in Xcode 15 beta 3 (15A5195k)
Here's a project to demonstrate the issue: import SwiftUI import Observation struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() } } typealias ResolveServiceCompletionBlock = (Bool, Error?) -> Void @Observable class ServiceBrowser: NSObject { fileprivate var resolveServiceCompletionHandler: ResolveServiceCompletionBlock? = nil } It seems like the issue is with the Observation protocol as removing @Observable works. Apple folks: FB12567650
Jul ā€™23
Reply to UIPointerStyle.hidden() with SwiftUI?
With UIKit, it is possible to set the pointer style or just hide it through the UIPointerInteractionDelegate: func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? { // Hide the pointer in the screen view return UIPointerStyle.hidden() } Iā€™m unable to find anything that would do the same on SwiftUI. Apple folks: FB12418053
Jun ā€™23