Latest0.2.0
Homepagehttps://github.com/ryuheechul/RACAutoDisposer
LicenseMIT
Platformsios 6.0, requires ARC
DependenciesReactiveCocoa
Authors

Version
License
Platform

Have a trouble because your RAC Subscriptions are being called even though you want them to be gone after reuse your views like UITableViewCell?

Solve the problem with adding few lines of code.

Just say you want the last subscription to be gone when this code called again.

@RACAutoDispose(@"[key-to-be-unique-in-a-scope]", {
  [RACObserve(self, object)
     subscribeNext:^(id x) {
         // ...
     }];
})

!Need to implemnt RACAutoDisposerProtocol to the scope object include @RACAutoDispose code

@interface ScopeObjectIncludesRACAutoDisposeCode () <RACAutoDisposerProtocol>

Other wise you will have warnings and unreleased RACDisposals which is a memory issue.

What do you mean scope?

if your @RACAutoDispose codes are in same object, then it is in same scope.
so keys need to be unique in a same scope to distinguish each disposals.

How it works?

  • RACAutoDisposer holds last RAC Disposals(subscriptions) by key and scope when @RACAutoDispose called.
  • RACAutoDisposer dispose the last Disposal with same key when same code called again. and hold new ones again.
  • RACAutoDisposer release disposals when the scope object is deallocated.

Sample Project

open Example/RACAutoDisposer.xcworkspace and run and see the results in console.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

ARC, ReactiveCocoa.

Installation

RACAutoDisposer is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "RACAutoDisposer"

Author

Ryu Heechul, [email protected]

License

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

Contribution

welcome your contributions!
send me pull requests or open a issue and give me an idea to make this better!

Latest podspec

{
    "name": "RACAutoDisposer",
    "version": "0.2.0",
    "summary": "Dispose RACSubscriptions with an easy way",
    "homepage": "https://github.com/ryuheechul/RACAutoDisposer",
    "license": "MIT",
    "authors": {
        "Ryu Heechul": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ryuheechul/RACAutoDisposer.git",
        "tag": "0.2.0"
    },
    "social_media_url": "https://twitter.com/ryuheechul",
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "dependencies": {
        "ReactiveCocoa": []
    }
}

Pin It on Pinterest

Share This