Post

Replies

Boosts

Views

Activity

Reply to Fatal error calling TranslationSession.translate(String) in iOS 18
I had the same problem and this is how I overcame it: I declared a field to track the state of the view @State private var isActive: Bool = true Then .onDisappear of the view, I set the value false. Also invalidate the configuration. .onDisappear{ self.isActive = false guard configuration == nil else { configuration?.invalidate() return } } and then here is the trick translationTask(configuration) { session in if(!self.isActive){ return } {...} } It will return before it tries to use session and won't cause the error anymore.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25