Skip to content

Legacy OS deployment target and Xcode 14

Latest
Compare
Choose a tag to compare
@theoriginalbit theoriginalbit released this 22 May 04:23
· 2 commits to main since this release

If your project is targeting iOS versions earlier than iOS 13 you may have run into the following error:

Compiling failed: '__designTimeString(_:fallback:)' is only available in iOS 13.0 or newer

You may see variations on the above with __designTimeInteger, __designTimeBoolean, or __designTimeFloat.

This update introduces a new PreviewViewLegacyOSCompileFix target to fix #3. Simply import it and you're back up and running.

Example for supporting iOS versions earlier than iOS 13:

#if canImport(SwiftUI) && DEBUG
import PreviewView
import PreviewViewLegacyOSCompileFix
import SwiftUI

@available(iOS 13, *)
struct YourNavigationController_Previews: PreviewProvider {
    static var previews: some View {
        ViewControllerPreview(YourNavigationController())
            .edgesIgnoringSafeArea(.all)
    }
}
#endif