In the WWDC 2020 session "What's new in SwiftUI
", there is mention of a new Global Accent Color.
Now, when you create a new SwiftUI project in Xcode 12, you will see an AccentColor added to your Assets.xcassets folder.
What if I have an existing project? How do I add a global accent color?
Here's what you do:
- If you haven't already, add a named color to your asset catalog to represent your global accent color.
- Select your project (top-most item in your project navigator).
- With either your Project or Target selected, click on:
- Build Settings
- Scroll down to the category "Asset Catalog Compiler - Options"
- There is a new entry there called "Global Accent Color Name". Double-click to the right of it and you can enter the same name you added in step 1 to the text entry box that shows up.
What do I do now?
Now all SwiftUI views that have an accent color will take on your global accent color name.