Skip to content

hboon/weak_attr_accessor

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 

#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

About

weak_attr_accessor for RubyMotion

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages