Check Mobile App
Read now
Start a Project

Add Gradient in UIView using Extension in Swift 3.0

Save

UIView Extension of Gradient

The extension is a great concept in swift in swift you can add your function is already predefined classes in swift 3.0 like String, UIView, UIColor etc.A while creating an extension you can write it anywhere in your project.To create a gradient extension you have to create an extension of UIView class.The main benefit of extension is that it will reduce many of your code lines like you have to use the gradient 5 times in your project so you have to write the same code 5 times in your project while creating an extension you have to write it only once it will also save the application memory.Example to create an extension:-

how to use Extension:- 

Add Transparency To GRADIENT:-

If you want to add transparency to the gradient, then you have to change the alpha of your colors:-

 

. . .

Leave a Comment

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


Be the first to comment.

css.php

Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.

Stathis Plakidas

Stathis Plakidas

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home