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 .xcassets and use that color in all over se of color name.

Creating color set in asset catalog (.xcassets)

Select the .xcassets directory in Xcode and select the plus 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

let color: UIColor
if #available(iOS 11.0, *) {
    color = UIColor(named: "blueColor")!
} else {
    color = UIColor(red: 84.0/255.0, green: 128.0/255.0, blue: 255.0/255.0, alpha: 1.0)
}

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

Break Statement in JAVA Break Statement in JAVA The break statement is usually used in following two scenarios: The break statement terminates the loop immediately, and...
How to install flutter | Flutter tutorial Flutter is the google’s mobile app SDK for develop the high-quality native app for iOS and android. We can develop the app by use of DART and javascri...
Comments in C Comments in C Comments in C language are used to provide information about lines of code. It is widely used for documenting code. There are 2 types o...
Strings String can be represented as a single-dimensional character type array. Strings in C are group of characters, digits, and symbols enclosed in quotatio...
Setting Class Path for Java Setting Class Path for Java In this tutorial we are study how we can set the java JDK class path. Java is an open source software, it is is freely...
Invitation Letter for Visa Invitation Letter Samples These letter are necessary for taking visa of another country. so these samples are the most important document. Sample 1 ...
Author

Write A Comment