Post

Replies

Boosts

Views

Activity

Reply to Additional Appearance Calls Triggered When Removing TabView or NavigationView/Stack From View Tree
I faced the same problem recently and my workaround is to create a view modifier for authenticated views and use it only for such screens/views: import SwiftUI struct GuardedOnAppearViewModifier: ViewModifier { let perform: () -> Void @EnvironmentObject private var accountState: AccountState func body(content: Content) -> some View { content .onAppear { guard accountState.isAuthorized else { return } perform() } } } extension View { func onGuardedAppear(perform: @escaping () -> Void) -> some View { modifier(GuardedOnAppearViewModifier(perform: perform)) } } So when I'm logging out none of my onAppear method of authorized views will be called during the removal of NavigationView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23
Reply to Not working ATTrackingManager.requestTrackingAuthorization callback on 17.4
A workaround is to call the async version of the function like this: Task { let result = await ATTrackingManager.requestTrackingAuthorization() // ... } Because it looks like they broke only the function with completion handler: ATTrackingManager.requestTrackingAuthorization(completionHandler: { _ in })
Replies
Boosts
Views
Activity
Mar ’24
Reply to Unable to build project for localization string extraction
I have the same issue and as figured it out some of my pods installed by Cocoapods causing it, because for example when I deleted Firebase pods, "Export Localizations" build worked fine. But still I don't know how to fix it by keeping needed pods
Replies
Boosts
Views
Activity
Aug ’23
Reply to Additional Appearance Calls Triggered When Removing TabView or NavigationView/Stack From View Tree
I faced the same problem recently and my workaround is to create a view modifier for authenticated views and use it only for such screens/views: import SwiftUI struct GuardedOnAppearViewModifier: ViewModifier { let perform: () -> Void @EnvironmentObject private var accountState: AccountState func body(content: Content) -> some View { content .onAppear { guard accountState.isAuthorized else { return } perform() } } } extension View { func onGuardedAppear(perform: @escaping () -> Void) -> some View { modifier(GuardedOnAppearViewModifier(perform: perform)) } } So when I'm logging out none of my onAppear method of authorized views will be called during the removal of NavigationView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’23