If you don't use the storyboard, it's a lot of inconvenience.
Segway is also intertwined, and it's not a good way, but it's inconvenient if you don't use a storyboard because you put a table view in a cell and a prototype cell in it.
I use the storyboard to create a view controller, and I want to inherit the request and some functions because they change depending on the situation The view controller created through the storyboard has an isa embedded in it, so subclass methods will not work if you cast it as a subclass.
When I was working with Objective C, I was able to take risks and change the isa directly or change the class to a lower class using object_setClass Changing classes at runtime while moving to Swift is not easy.
I would like to ask you if there are any good ways to change to nib or not use the storyboard. Please give me your opinion whether I made a wrong structure or if there is a suitable design pattern in this case.
ios swift storyboard viewcontroller inheritance
In this case, I create a class that handles API requests separately.
AModel, BModel, CModel
AViewController
If you subtract the code that acts as a request in this way, you can use the same View Controller while creating only the model instead of creating it again.
Among the questions
The view controller created through the storyboard has an isa embedded in it Subclass methods will not work if you cast them as subclasses.
I don't understand the part,
There seems to be a reason why the class cannot be changed in the Identity Inspector of the Utility panel, but I can't predict the reason. And as in the swift code? Can't you be cast as?
Inheritance is necessary because requests or functions can be changed depending on the situation I'd like to receive it
In this case, can't we initialize the view controller of a particular identifier as code in the UISstoryboard instance?
If the above method is not possible, please explain the situation in more detail.
© 2024 OneMinuteCode. All rights reserved.