Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bind properties to a key path on another object

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 Frameworks
Octocat-spinner-32 KeyPathBindings.xcodeproj
Octocat-spinner-32 MAZeroingWeakRef @ 4082c7f
Octocat-spinner-32 Source
Octocat-spinner-32 Specs
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .gitmodules
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
README.md

Description

http://spin.atomicobject.com/2011/06/16/objective-c-keypath-bindings/

KeyPathBindings is a library for binding a property to a key path on another object. This can be particularly useful when you want a property on an object to mirror a property on another object. The library can optionally be configured with MAZeroingWeakRef to automatically zero bindings.

Note: This library subclasses observed objects -- which means already KVO'd objects will not work.

Example

  @interface MySlider : NSObject
  {
    CGFloat percentComplete
  }

  @property(nonatomic, assign) CGFloat *percentComplete;
  @end

  ...

  [request bindProperty:@"percentComplete" onTarget:mySlider toKeyPath:@"percent"];

  request.percent = 0.54f;
  NSCAssert(mySlider.percentComplete == request.percent);

Authors

Something went wrong with that request. Please try again.