0017 - Use Swift to build watchOS app
ID: | ADR-0017 |
---|---|
Status: | ACCEPTED |
Published: | 2022-12-30 |
Context and Problem Statement
We would like to ship a watchOS application bundled together with the regular iOS application. The watchOS application will act as a companion application and initially offer a way to view TOTP codes from the watch which were previously synchronized from the iPhone.
Considered Options
Decision Outcome
Chosen option: Swift using SwiftUI.
Positive Consequences
- Supports watchOS fully
- We can build and debug the app properly
- Fast development with declarative UI and Previews to enhance the dev experience
- Code organized using components on the UI
- Updates to the framework and the SDKs are available as soon as Apple ships them
- A lot more documentation, examples and public repositories to check
Negative Consequences
- New tech stack to learn for the team
- Even though we can debug the app properly we can't debug the iOS and the watchOS app at the same time (when debugging the watchOS app, a stub iOS app is installed on the iPhone so the original one is overridden by the stub one)
- Set up is harder given that we need to bundle the XCode built watchOS app into the Xamarin iOS app and update CI accordingly
Pros and Cons of the Options
.Net using Xamarin
- ✅ Keeps same tech stack
- ✅ Shares a lot of code
- ✅ Easier learning curve and reviews
- ✅ Easy integration into the regular iOS app
- ⛔ Several important issues affecting the watchOS dev experience, particularly can't debug correctly
- ⛔ watchOS platform not being a priority for the .Net team
- ⛔ No plans to include watchOS support on MAUI and neither on .Net 7 nor on .Net 8
Swift using WatchKit
- ✅ It's the native approach meaning it's always up to date
- ✅ Lots of documentation and examples/projects to look
- ✅ Debugging works as expected
- ⛔ Steep learning curve (language + watch related stuff)
- ⛔ Hard to integrate to the regular iOS app
Swift using SwiftUI
- ✅ It's the native approach meaning it's always up to date
- ✅ Lots of documentation and examples/projects to look
- ✅ Debugging works as expected
- ✅ Fast development with SwiftUI Framework
- ✅ Previews enhance the development experience to the sky taking a lot less effort
- ⛔ Steep learning curve (language + watch related stuff + SwiftUI framework)
- ⛔ Hard to integrate to the regular iOS app
- ⛔ SwiftUI is not polished enough yet so some things to keep in mind are special navigation and rendering issues