diff --git a/TalerCommon/ViewModifier/View+DeviceRotation.swift b/TalerCommon/ViewModifier/View+DeviceRotation.swift index c059c2a1..d011856b 100644 --- a/TalerCommon/ViewModifier/View+DeviceRotation.swift +++ b/TalerCommon/ViewModifier/View+DeviceRotation.swift @@ -32,7 +32,16 @@ struct DeviceRotationViewModifier: ViewModifier { func body(content: Content) -> some View { content - .onAppear() // SwiftUI bug: view modifiers do not work with onReceive() unless you first add onAppear() + // SwiftUI bug: view modifiers do not work with onReceive() + // unless you first add onAppear(). + // + // Report the orientation the view appears in, too, not only + // later changes. Without this a view that is already in + // landscape when it appears never hears about it: the app + // launched in landscapeRight leaves `oimModeActive` false, so + // the OIM presentation is missing until the user rotates away + // and back again. + .onAppear { action(UIDevice.current.orientation) } .onReceive(NotificationCenter.default.publisher(for: UIDevice.orientationDidChangeNotification)) { _ in action(UIDevice.current.orientation) }