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
In this blog, I am discussing how we can reduce a bunch of repetition code.
In old code structure, we use different storyboard and each storyboard contains multiple view controllers.
So moving from one controller to another firstly we have to create an instance of storyboards and create the reference of view controller from that we can push or present view controller over the current view controller and that same code we have to write in each class where we are moving from one controller to the another.
Here is the example of repetition which we usually used to write:-
As we all know in swift, we say enum class first last so with the use enum we create a number of case equal to the number of storyboards our project contains with their raw value(which refers their actual name):-
For moving one controller we need these things one is storyboard instance and another is view controller reference.
From storyboard raw value we can get storyboard instance and from View controller itself, we can get view controller’s identifier from them we can create there reference. so we can use generics to implement this feature in the enum:
How to use them:-
I hope from this, it will make you more comfortable dealing with different storyboards and view controllers. Thanks for tuning in once again!
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.
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
All communication is done through a ticket system. I appreciate the regular almost daily updates of what is being worked on, and communicating changes or updates is easy through this system. Mobikul's response timeframe is quick.
Josh Arnold
Owner, Shop ATV Escape
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.