Complications for watchOS with SwiftUI | raywenderlich.com

Learn how to create complications in SwiftUI that will accelerate your development productivity, provide delightful glanceable displays and give your users a single-tap entry point with which to launch your watchOS app.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/17749320-complications-for-watchos-with-swiftui

When trying to run the downloaded project I get a SIGABRT crash in getLocalizableSampleTemplate and this message in console

RenderBox precondition failure: pipeline error: primitive_color-13f45000082843: Compiler encountered an internal error.

Hi I just downloaded the project and ran it against Xcode Version 12.4 (12D4e) and selected the complication from the complication picker on the Meridian face. It all seems good.

Which version of Xcode are using , which Simulator and which face. That might help with tracking down a workaround.

I am running Xcode Version 12.4 (12D4e), Apple Watch Series 6 - 44mm simulator running watch os 7.2 paired to iPhone 12 simulator running iOS 14.4. My laptop is MacBook Pro Mid 2015 2.2 GHz (no standalone graphics) running Mac OS 10.15.7.
The reason why I post my macbook specs is because this seems to be crash inside Metal so maybe that’s part of the problem.

Switching to watch os 7.0 simulator “fixed” the problem. But still 7.2 is not usable and previews are also don’t work in Xcode. Just saying “it took more than 5 seconds bla bla…”

Oh, and I am also using Meridian face

I guess you have your work around. At this point Xcode will be using the phrase “it’s not you, it’s me” :slightly_smiling_face:

I’m on Big Sur and watch os 7.2 seems ok . I guess fling it at the latest beta and see if that fixes the issue too.

Sorry that Xcode is being weird but that’s kind of the way of things. It’s nothing in particular to do with the project in all likelihood.

Absolutely agree. Seems like an Xcode bug in particular configuration of software and hardware. Thanks you for quick looking into the problem.

Hello. Can I resize the text or make it different case in makeUtilitarianLargeFlat?
Example: “My Text”
@warrenburton

These are the text providers you can work with

Apple Developer Documentation.

when you construct a CLKComplicationTemplateUtilitarianLargeFlat complication

Apple Developer Documentation.

You might find a trick to get lower case text in the data prover API however complications tend to force uppercase text for visual clarity.

I’m sorry, maybe you can help with the solution. How can I use WKNotificationScene with WKExtensionDelegate and WKInterfaceController?

Hi. That’s not an aspect of WatchKit that I have ever played with. Depending on your RayWenderlich site subscription you might be able to read watchOS With SwiftUI by Tutorials, Chapter 6: Notifications | raywenderlich.com

Thank you but I apologize for my lack of specificity. If I want to change sashColor and titleColor in WKUserNotificationHostingController. But I have access to notifications through the storyboard. How can i do this?