Instead of using C macros, which are terrible, and adding a category for every class that conforms to UITraitEnvironment, we ought to just use a Swift protocol extension. A friend sent in an example that replicates our existing functionality: https://gist.github.com/asmallteapot/cf91cca4fe692932fac9
This would be way better. The only reason I didn't use this approach is because I tried but Xcode fought back, so I went with C macros (sometimes easier than fighting with Xcode!). But this is better.
Don't think it's worth rushing to add swift code unless it really does add something useful, we're limiting the consumers of the library to people using frameworks then.
Instead of using C macros, which are terrible, and adding a category for every class that conforms to
UITraitEnvironment
, we ought to just use a Swift protocol extension. A friend sent in an example that replicates our existing functionality: https://gist.github.com/asmallteapot/cf91cca4fe692932fac9This would be way better. The only reason I didn't use this approach is because I tried but Xcode fought back, so I went with C macros (sometimes easier than fighting with Xcode!). But this is better.