4 ms·
I think the API's for iOS aren't that awful but they've been designed in a different era for a different programming language. Untyped dictionaries as parameter
by dep_b 9y ago
I think the API's for iOS aren't that awful but they've been designed in a different era for a different programming language. Untyped dictionaries as parameters for a method that actually will crash if you supply the wrong value for the wrong key is just against pretty much any philosophy that's behind Swift.
Also the current state of how ViewControllers interact with each other and the views just doesn't work too well with Swift. I tend to use coded views instead of Interface Builder just to get rid of those IBOutlets that only get set after init, forcing me to make them optional or crash-prone force unwrapped.
In Objective-C in conjunction with a clever type replacement for the root view it actually isn't so bad because everything is optional anyway.
It's impossible to overhaul the whole SDK without freaking out developers, but step by step things improve. A compile time error for outlet problems would be a good step.
- g09980 9y agoRe: avoiding IB, https://github.com/SnapKit/SnapKit https://github.com/SnapKit/SnapKit is a lifesaver, a lightweight DSL that nearly 1-to-1 wraps around AutoLayout APIs.
- dep_b 9y agoTried it, didn't really like the syntax but Cartography has some performance problems so at the moment I'm back to hand rolled wrappers that are somewhat leaky but a lot less verbose and more readable: Constraint.space(imageView, .horizontally, to: textView, distance: 8) I can imagine going back to SnapKit though. It really did what it should do.