#weak_attr_accessor for RubyMotion
Do this:
class MainView < UIView
weak_attr_accessor :view_controller
end
instead of this:
class MainView < UIView
def view_controller
@view_controller
end
def view_controller=(obj)
if obj.nil?
@view_controller = nil
else
@view_controller = WeakRef.new(obj)
end
end
end
- Add this to your
Gemfile
:gem 'weak_attr_accessor'
- Run
bundle install
BSD. See LICENSE file.
- Email: hboon@motionobj.com
- Web: http://hboon.com/
- Twitter: http://twitter.com/hboon