-
Add CocoaPods to RubyMotion project
# Gemfile gem "motion-cocoapods"
-
Install
bundle install
-
Add
Masonryto projectMotion::Project::App.setup do |app| # ... app.pods do pod 'Masonry' end end
-
Install
Masonry[bundle exec] rake pod:install
-
Use
Masonryas usual but remember to call theProcreturned by methods# mas_makeConstraints takes either a stabby lambda or Proc @my_button.mas_makeConstraints ->(make) { make.top.equalTo.call(self.view.mas_top).with.offset.call(padding.top) make.left.equalTo.call(self.view.mas_left).with.offset.call(padding.left) make.bottom.equalTo.call(self.view.mas_bottom).with.offset.call(-padding.bottom) make.right.equalTo.call(self.view.mas_right).with.offset.call(-padding.right) }
Note the .call for calling the Proc with an argument.
lib/masonry.rb adds some shortcuts to MASViewConstraint and MASCompositeConstraint eliminating the need for .call.