Android App Development
iOS App Development
Flutter 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 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Hello guys, Today we learn about @IBDesignable And @ IBInspectable in Swift.
@IBDesignable:- When we want to change our custom outlet design from the StoaryBoard or .xib files at a time we will use @IBDesignable functionality. for this, we need to create a class and mark that class name with the @IBDesignable attribute.
@IBInspectable:- When we want to make some part of the custom view subclass configurable inside the @IBInspectable builder it allows us to create an attribute that is assigned in storyboard or .xib
Getting Start:- Let’s take an example, I am taking a view and TextView and want to change their design like I want to give some shadow, the border with, and borderColor to the view outlet and set some padding in my textView
step1:- Firstly, create a new Xcode project.
File-> New-> Project-> Choose Ios-> choose App-> next and Add your project name then create.
Step2:- Then, take a View or textView
Step 3:- Then, create a new swift class
File–> New–> File–> Select Cocoa Touch class –> and create a class
Step4:- Now, write the code
This code is for UIView outlets like- View.
This code indicates for textView – it is used for padding purposes.
Here we are using the did Set or get Set method so here is what is did Set and get Set method in swift?
GetSet:- To write a value we use the set method and to read a value we use the get method. The common use would be data handling with persistent storage.
DidSet:- didSet is called right after the data is stored and it has a default constant that shows the previous value that is overwritten.
Output:- Now, run your project and see the result.
In this blog, we discussed @IBdesignable And @ IBInspectable in Swift
I hope this blog will help you to understand the working of @IBdesignable And @ IBInspectable in Swift
Thanks for reading!!!
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.
Vincenzo Carrano
Administrator, Segshop
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.