How do I Add a Global Accent Color to a SwiftUI 1.0 Project?
June 26, 2020
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:
  1. If you haven't already, add a named color to your asset catalog to represent your global accent color.
  2. Select your project (top-most item in your project navigator).
  3. With either your Project or Target selected, click on:
    1. Build Settings
    2. All
  4. Scroll down to the category "Asset Catalog Compiler - Options"
  5. 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?

That's it!

Now all SwiftUI views that have an accent color will take on your global accent color name.

No comments yet
Write a comment...


Gain exclusive access to Big Mountain Studio 
  • News
  • Tutorials
  • Updates, etc.
When signed up, you get posts delivered right to your Inbox!
Includes access to 1 product:
Get access