This is a hack, but I created an objc header to make the UITraitCollection definition available to watchOS.
This allowed for the UIColor(named name: String, in bundle: Bundle?, compatibleWith traitCollection: UITraitCollection?) method to be accessed.
Objc header file added to the framework:
#if TARGET_OS_WATCH
@import UIKit;
@interface UITraitCollection : NSObject
@end
#endif
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: