Add a Color xml class to read color from storyboards
For each OS
I create an extension for the XXXColor class if there is at least one color
and in there I create a constant variable for each asset color. An asset color have a name and are not a "System" one (so I have filtered system color like labelColor, etc...)
For other colors I think about adding it in controller.
See one of the Storyboards.swiftfile
I use the generated constant in demo app in MainViewController.swift
This new functionality of Xcode9/iOS11 seems to have some bugs
In Xcode if we have multiple asset with same color name, sometimes the interface builder use a color from another asset.
workaround, use a shared asset between device and use idiom (not universal) if we want a different color by device
When using an asset color in view background, the color set by prepare(for segue:seems to not be taken into account on iOS and tvOS.
maybe the color is set later in view loading process if this case.
workaround: create a color variable in destination controller, and in viewDidAppear (and maybe in viewDidLoad) use the color to set as view background color
An other approach is to generate code from asset.
I want to make this generation optional later.
Maybe with a json config file (like #55), now with swift 4 this is easier
only for iOS11,tvOS11,macOS10.13 https://littlebitesofcocoa.com/312-asset-catalog-improvements
Add a
Color
xml class to read color from storyboardsFor each OS
For other colors I think about adding it in controller.
See one of the
Storyboards.swift
fileI use the generated constant in demo app in
MainViewController.swift
This new functionality of Xcode9/iOS11 seems to have some bugs
prepare(for segue:
seems to not be taken into account on iOS and tvOS.An other approach is to generate code from asset. I want to make this generation optional later.
Maybe with a json config file (like #55), now with swift 4 this is easier