Asset Color Catalog | Swift Tutorial

Asset Color Catalog is the feature of XCode 9. BY the use of this feature we can maintain the colors easily and avoid the mistakes. We can create the color catalog in 


 and use that color in all over se of color name.

Creating color set in asset catalog (



Select the .xcassets directory in Xcode and select the 


 button on the bottom left and select 

New Color Set

. Change the name of your color at right top corner and change the color RGB value according to you. Make sure your color name is unique to other color which are defined by you in same project.


Asset catalog colors in Storyboards

We can use this asset catalog color in Storyboard and Interface Builder file. When you selecting the color for views, You can see your color under the “Named colors”.

Asset catalog colors by code

<span class="hljs-keyword">let</span> color: <span class="hljs-type">UIColor</span>
<span class="hljs-keyword">if</span> #available(iOS <span class="hljs-number">11.0</span>, *) {
    color = <span class="hljs-type">UIColor</span>(named: <span class="hljs-string">"blueColor"</span>)!
} <span class="hljs-keyword">else</span> {
    color = <span class="hljs-type">UIColor</span>(red: <span class="hljs-number">84.0</span>/<span class="hljs-number">255.0</span>, green: <span class="hljs-number">128.0</span>/<span class="hljs-number">255.0</span>, blue: <span class="hljs-number">255.0</span>/<span class="hljs-number">255.0</span>, alpha: <span class="hljs-number">1.0</span>)

Create color in Xcode/storyboard use for all projects

We can also create the color in storyboard and use this color in your Xcode for all projects.

Download Demo From here

Related Post

Create Gradient layer by the use of CAGradientLaye... Create Gradient layer by the use of CAGradientLayer Mostly developers are use the gradient (Combination of colors) colors images for make app more ef...
New features in XCode 10 Supported Configurations Xcode 10 beta requires a Mac running macOS 10.13.4 or later Xcode 10 beta includes SDKs for iOS 12, watchOS 5, macOS ...
Resignation Letter and Relieving Letter Resignation Letter Sample 1 Sender’s Name, Sender’s Address, Mobile Number, MailDate:ToThe Human Resource Department Company Name Company Addre...
Control Flow Statements | Swift tutorial Control Flow : Swift tutorial Swift Provides diffrent type of controll flow statements like: Loops Statements : Loops are used for perform the t...
Data Type And Storage And Keywords To store data inside the computer we need to first identify the type of data elements we need in our program. There are several different types of dat...
Introduction To C A Brief History Of C   C was invented and first implemented by Dennis Ritchie on a DEC PDP-11 that used the Unix operating system. C is the r...

Leave a Reply

Your email address will not be published. Required fields are marked *