3 ms·
I see. You don't have to use the Interface Builder(the WYSIWYG drag and drop stuff) at all. The empty state of any new project will be initiated with it but yo
by mrtksn 7y ago
I see. You don't have to use the Interface Builder(the WYSIWYG drag and drop stuff) at all. The empty state of any new project will be initiated with it but you can simply delete it, remove any reference to it from the other files and do code-only UI.
That said, after some un-learning, I found that this Interface Builder is actually very powerful in taking care of the mundane stuff and so you can concentrate on the more interesting things. This is because you can interact with the drag-and-drop elements as if they were written in code, this thing doesn't generate some weird markup that you have to understand, instead, you interact with it through API in your code(essentially, linking the visually created element to a variable in your code. Once linked, you can work with that visual element as if it was created through code).
The positioning is done through constraints, you can have conflicting constraints with different priority and you can change these priorities in your code to have nice animations. You can add constraints, remove constraints, turn on/off constraints from your code, you can do everything nicely mixing the code with the Interface Builder. It's really amazing once you get over your previous ways of doing things and embrace the Apple way.