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

Introduction to Java Programming Language JAVA TUTORIALS Introduction to Java Programming Language What is JAVA Java is programming language that produces software for multiple platforms, w...
How to use Flutter most usable Widgets | Flutter t... We need some basic widgets for creating our first flutter app. Widgets describe what their view should look like given their current configuration and...
New Features XCode 12 – IDE Supported Configurations Xcode 12 beta includes SDKs for iOS 14 iPadOS 14 tvOS 14 watchOS 7 macOS 11 The Xcode 12 beta release supports o...
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...
Loop Control Statement Loop control statements are used when a section of code may either be executed a fixed number of times. C gives you a choice of three types of loop st...
Introduction to JVM Introduction to JVM JVM stands for Java Virtual Machine. It works as an engine that derives the Java Code. The JVM does not understand Java ty...
Author

Write A Comment