Search code examples
swiftxcodeswiftui

Xcode 11 beta swift ui preview not showing


Just playing with Swift UI basic app and the preview canvas is not showing even though I'm in canvas mode. App runs, and I have this little snippet what am I missing?

#if DEBUG
struct ContentView_Previews : PreviewProvider {
    static var previews: some View {
       ContentView()
    }
}
#endif

Solution

  • To preview and interact with views from the canvas in Xcode, ensure your Mac is running on Catalina MacOS.

    https://developer.apple.com/tutorials/swiftui/creating-and-combining-views

    Please check apple document in the following URL https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_2_release_notes

    Xcode 11 beta supports development with SwiftUI.

    Note

    Tools for SwiftUI development are only available when running on macOS Catalina 10.15 beta.