4 ms·
Layout done in code: - Is type-safe, which is verified at compile-time. - Will break at compile-time if a breaking change is made. - Can be null-safe, withou
by cballard 11y ago
Layout done in code:
- Is type-safe, which is verified at compile-time.
- Will break at compile-time if a breaking change is made.
- Can be null-safe, without having to use Optional for everything.
- Can do things iteratively.
- Can use constants, so that you can easily modify standard paddings and sizes globally with one change.
So those are some of the advantages of doing layout in code.
- allsystemsgo 11y agoRight but you'd have to document what each constant represents. Interface builder gives us a universal language. You know what the UI will look like or how it will resize etc. because it's right there. There's no confusing constant names with magic numbers. You know the why behind the constraint values because you can see it.
- deleted 11y ago[deleted]
- rimantas 11y agoConstants are not magic numbers. And with proper naming they document themselves. For more cusotm UI's you won't know how UI will look like. It got better with @IBDesignable but still not enough.