Post

Replies

Boosts

Views

Activity

Reply to In SwiftUI in iOS 18.1, `SectionedFetchRequest` is not refreshed when changes are done to the fetched entity's attributes.
While waiting for some official statement why this is happening in iOS 18 and not iOS 17, I found a workaround to force a refresh of the managedObjectContext when changes are saved. Code sample: @Environment(\.managedObjectContext) private var managedObjectContext var body: some View { NavigationStack { Text("") } .onReceive(NotificationCenter.default.publisher(for: .NSManagedObjectContextDidSave)) { _ in DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { withAnimation { managedObjectContext.refreshAllObjects() } } } } It's not perfect but it gets the job done to update the list when any attributes are changed, not only those used as SortDescriptor. Hope this helps anyone facing this problem.
10h
Reply to Calling `requestAuthorization(options:completionHandler:)` in Swift 6 leads to `EXC_BAD_INSTRUCTION` crash.
I will add my initial solution as a comment so it can be marked as solution to the question. The only solution that I have found so far is to switch to using the async version of the requestAuthorization API: Task { let center = UNUserNotificationCenter.current() do { if try await center.requestAuthorization(options: [.alert, .sound, .badge]) == true { print("success") } else { print("fail") } } catch { print("Error") } }
Oct ’24
Reply to How to Fix Cracking and Popping Sound ?
This sound popping issues started happening with Xcode 12 and it has been months with no fix. Problem is that simulators (SwiftUi views are using them also) and the fact that phones do not have the same "sound" hardware a.k.k simulators actually change the output of the sound you hear in on your Mac (because they "simulate" it to show what the phone would do). Unfortunately this causes many many issues on the Mac sound hardware but is 100% fixable by the Xcode team, we cant do anything ourselves its a problem if the simulators "highjacking" the systems sounds and outputting it via a hardware that is not supposed to output this way. This is mind boggling that it is still not fixed.
Dec ’20