weak_attr_accessor for RubyMotion
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
LICENSE
README.md
weak_attr_accessor.gemspec

README.md

#weak_attr_accessor for RubyMotion

Usage

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

Installation

  1. Add this to your Gemfile: gem 'weak_attr_accessor'
  2. Run bundle install

License

BSD. See LICENSE file.

Questions