Migration
-
big one first: there are no helpers. so
btn.titlewon't work.:-|
and
snake_casemethods no longer work.:-|
-
the styling DSL is gone. style methods now accept the view as an argument, and you just call Cocoa/CocoaTouch methods on the view.
# change this: def label_style text 'Hi!' end # to this: def label_style(lbl) lbl.text = 'Hi!' end
Why this change? 1. Simplicity. So much confusion and complication around the DSL, only for a minor bump in readability (and a huge loss of comprehensible code)
-
Layoutnow extendsNSVieworUIView. This means you no longer ask the layout for its view, the layout IS the view. -
def layoutis nowdef mk_layout(becauselayoutis anNSViewmethod, and layouts are views, so...) -
constraints do .. endis nowauto_layout do |c|.. end(constraintsis aUIViewandNSViewmethod). Use thec(or whatever you call it) variable to generate constraints. The DSL hasn't changed, but you need to use this instance directly.auto_layout do |c| c.width == :superview c.height == 10 end
-
the
originconstraint is gone, because it is ambiguous on osx vs ios. usetop_leftinstead. -
added cell classes
MK::TableCellLayout,MK::CollectionCellLayout -
reapply!isrestyle!. An error is produced so you can update your code. -
removed
initial(just put the code in the_stylemethod,reapplystill exists)