Using previewInterfaceOrientation results in runtime crash on iOS 14

Using Xcode 13 beta 2:

In my SwiftUI preview code I add previewInterfaceOrientation like so:

static var previews: some View {
    Group {
        Preview()

    #if swift(>=5.5)
        if #available(iOS 15.0, *) {
            Group {
                Preview()
            }
            .previewInterfaceOrientation(.landscapeRight)
        }
    #endif
    }
}

With this code and running on an iOS 14 device the app crashes immediately with dyld: Symbol not found: _$s7SwiftUI4ViewPAAE27previewInterfaceOrientationyQrAA0eF0VFQOMQ

It would seem I can't use this handy interface orientation option in Previews until the app's minimum target is iOS 15. It seems like a bug in the framework because that symbol should be considered optional as it is surrounded by if #available.

Answered by mmrussell in 687729022

This appears to have been fixed with Xcode 13 RC. Tested by running on an iOS 14.7.1 device.

FYI, Issue still appears to exist in Xcode Beta 3

Accepted Answer

This appears to have been fixed with Xcode 13 RC. Tested by running on an iOS 14.7.1 device.

Using previewInterfaceOrientation results in runtime crash on iOS 14
 
 
Q