Friday, August 4, 2017

Visualized custom color in swift code with Color Literal

This post is written with Xcode 8.3.3 and Swift 3.1.

It is very common to set a UIColor with autocomplete as below:



However, there is a better way to select a custom color visually.
Type Co to find Color Literal with Xcode' automatic complete feature.


Then select a color. There are more color options with the color literal than with UIColor.colorName.


So we can see the color in the code instead of strings such as orange, red, ... ect.

There are also literal icons/images. For more information, see:

Be Literal! – iOS App Development

1 comment:

  1. SWIFT code stands for the Society for Worldwide Interbank Financial Telecommunication code that is a form of Business Identifier Code (BIC) identified by the International Organization for Standardization or ISO.
    Regards,
    IFSC Code

    ReplyDelete