1

I am attempting to deploy a SwiftUI app to an Apple Watch Series 2 with WatchOS 6.3, from an iPhone running iOS 15. After connecting the device to Xcode and clicking the build button, I get errors that indicate @SceneBuilder, Scene, WindowGroup, and NavigationView are only " only available in application extensions for watchOS 7.0 or newer". Is there a way to configure this file (or some other part of the Xcode environment) to enable the app to work with WatchOS 6.3 or lower?

See the screenshot below. Thanks!

enter image description here

JS_is_awesome18
  • 1,587
  • 7
  • 23
  • 67
  • Well the issue is self explaining, if your watchOS is not support version 7.0 or newer, then you need depend on app, if you do not want depend then you need to have version 7.0 or newer. – ios coder Dec 07 '21 at 07:00
  • Try setting up the AppDelegate lifecycle https://stackoverflow.com/questions/69703928/how-to-generate-ios-13-swiftui-project-in-xcode/69708009#69708009 – lorem ipsum Dec 07 '21 at 10:25

1 Answers1

0

Please, check out official example: Developing a User Interface with SwiftUI. Basically you need to create storyboard-based interface and put a WKHostingController there (see InterfaceController.swift above). And there you will load SwiftUI view. You may also look at WWDC 2019 video #219: SwiftUI on watchOS.

kelin
  • 11,323
  • 6
  • 67
  • 104