Post

Replies

Boosts

Views

Activity

Reply to NavigationBarHidden & swipe back
You may be getting the navigation controller’s gesture handling into some state that it’s not intended to handle. I had a similar (or perhaps the same) issue where when swiping back on the root screen (which doesn’t do anything obviously, but nevertheless is possible and as it turns out I do often while trying to scroll vertically), the controller will mess up the transition of the next navigation operation, appearing to 'freeze' until moved to the background and brought back. I solved this by implementing the gesture begin delegate method, and rejecting the gesture when on the root screen. Maybe worth trying for your case? You can see an example of doing this here: https://github.com/siteline/swiftui-introspect/blob/main/Tests/UITestsHostApp/StatusBarStyle/NavigationView.swift#L42. func gestureRecognizerShouldBegin(_: UIGestureRecognizer) -> Bool { viewControllers.count > 1 }
Feb ’24
Reply to TaskGroup Crash
Here’s the only code in my codebase that uses TaskGroup. // Function that processes a bunch of 'action triggers' and produces a stream of actions func run(action: Action, find: @escaping (Model.Type) -> Model?) -> AsyncStream<Action> { AsyncStream { continuation in Task { await withTaskGroup(of: Void.self) { group in for trigger in triggers { group.addTask { for await result in trigger(action, find) { if result is VoidAction { continue } continuation.yield(result) } } } await group.waitForAll() continuation.finish() } } } } // Later, from an async context. Process an action and dispatch its output. Task { for await output in run(action: action, find: { store.find($0) }) { try await store.dispatch(output) } } I was able to solve the crash by explicitly marking both the task group’s closures as @MainActor. But would love to get a deeper understanding of why this doesn’t work. await withTaskGroup(of: Void.self) { @MainActor group in for trigger in triggers { group.addTask { @MainActor in for await result in trigger(action, find) { if result is VoidAction { continue } continuation.yield(result) } } } await group.waitForAll() continuation.finish() }
Apr ’22
Reply to kLSRErrorDomain Error 301
Ok, after some investigation it looks like kLSRErrorDomain/301 is new in iOS15 and is reported when you cancel a speech recognition request, but only on newer devices (specifically, devices with a CoreML-compatible neural engine — A12 Bionic and newer). So it looks like iOS15 changes the way speech recognition is handled by the neural engine, resulting in a new error code. Cancelling tasks previously seemed to result in a kAFAssistantErrorDomain/216. 216 is still present in iOS15 though, not sure on the details.
Sep ’21
Reply to RemoteIO Glitch With Sound Recognition Feature
The answer to this, ultimately, was to ditch using RemoteIO and use AVAudioEngine. It has a TON of its own quirks (have fun hunting down crashes when you make even the tiniest mistake with connections and formats or engine lifecycle), but if you respond to the engine reset event it mostly continues working when Sound Recognition is toggle on and off.
Sep ’21