When I last worked on watchOS complications over a year ago, storyboards were allowed. Back then you just created your application/complication and they ran fine on the watch and could be easily added to the watch face. Now that I have gotten back to watchOS without the storyboard, using only Swift, I just created my app, ran it on the simulator and then on the watch (via the cables to the iPhone) and it worked just fine on the watch. I have never seen anything about a WidgetKit extension or a complication family. If those are needed to make the complication be available to be added to the watch, please direct me to the documentation where this additional requirement is located.
Here is the contents of my ContentView.swift file that I am trying to add to the watch face (this is just the default app created when you choose to create a WatchOS app), but it doesn't show up in the list to be added.
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
Topic:
App & System Services
SubTopic:
Core OS
Tags: