Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Owner and Founder. Opencart
Hello Guys , I hope you all are enjoying mobikul blogs.
In today’s blog we will write a small program about the use of typealias in swift.
Now the first thing is “What is typealias and how to use it in our programming?”. Your answer is written below.
Typealias – A type alias declaration introduces a named alias of an existing type into your program. Type alias declarations are declared using the keyword typealias and have the following form:
typealias name = existing type
eg. typealias myDataType = String
ok , lets start by understanding the following code.
Alright guys lets dive into the code and learn whats happening here.
typealias test = (Bool?) -> Void
Created a test named typealias of type (Bool?)->Void
typealias stringType = String
Created a stringType named typealias of type String
The above function will take test type parameter and will call it.
The function callvalueFalse will take two parameters of type test and stringType and will call the test after 3 seconds.
the @escaping keyword represents that our closure will escape the function means first the function will complete and on its completion the closure will get executed.
now inside our button action we called the functions.
self.valueLabel.text = “false”
the false text is assigned to label after 3 seconds because the callvalueFalse functions closure will get executed after 3 seconds.
i.e why we declared escaping there.
Thats enough guys If you have any confusion please comment below.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.