Skip to content
Bind properties to a key path on another object
Objective-C C
Failed to load latest commit information.
Frameworks Initial check in of NSObject KeyPathBinding Jun 15, 2011
KeyPathBindings.xcodeproj
MAZeroingWeakRef @ 4082c7f Point to trunk on MAZeroingWeakRef Jun 21, 2011
Source Revert "Overload class method to give the appearance that the object … Jun 17, 2011
Specs Updated wording in spec Jun 16, 2011
.gitignore Initial check in of NSObject KeyPathBinding Jun 16, 2011
.gitmodules Renamed project and added MAZeroingWeakRef as a submodule Jun 16, 2011
LICENSE Initial check in of NSObject KeyPathBinding Jun 16, 2011
README.md Added link to blog post. Jun 16, 2011

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.