MSWeakProxy

MSWeakProxy


License
MIT
Install
pod try MSWeakProxy

Documentation

WeakProxy

platform GitHub license

=============

Features

An NSProxy object for turning a weak references .

Installation

Cocoapods(Recommended)

  1. Add pod 'WeakProxy' to your Podfile.
  2. Run pod install

Manual

  1. Add all files under WeakProxy to your project

Requirements

  • iOS 5.0 and greater
  • ARC

Examples

Code:

Objective-C

    /* - parameter:  repeats  If YES, the timer will repeatedly reschedule itself until invalidated. 
                              If NO,  the timer will be invalidated after it fires.
    */
    
    WeakProxy *weakProxy = [WeakProxy weakProxyForObject:self];//turning a weak references of self,
    
    NSTimer* timer = [NSTimer timerWithTimeInterval:0.25 target:weakProxy selector:@selector(timer) userInfo:nil repeats:YES];
    [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];


//    [NSTimer scheduledTimerWithTimeInterval:interval target:weakProxy selector:@selector(timer) userInfo:nil repeats:YES];


    - (void)timer{
         NSLog(@"%s",__func__);
    }

          

Credits

WeakProxy was created by Jiang.Zijia in the development of MOMO.

License

WeakProxy is available under the MIT license. See the LICENSE file for more info.