Rightpoint / RZDataBinding

Lightweight KVO-based data binding options.
Other
543 stars 57 forks source link

Misleading typo in documentation for `RZDB_AUTOMATIC_CLEANUP` #39

Closed jkaufman closed 9 years ago

jkaufman commented 9 years ago

Misleading typo in documentation for RZDB_AUTOMATIC_CLEANUP

The comment preceding the definition of RZDB_AUTOMATIC_CLEANUP reads: If enabled, it is safe to observe or bind to weak references, and there is need to call rz_removeTarget or rz_unbindKey before targets or observed objects are deallocated.

Expected: Text should read "… there is no need …" Actual: Text reads "there is need"

Full comment below:

 *  Set this to 1 (recommended) to enable automatic cleanup of observers on object deallocation.
 *  If enabled, it is safe to observe or bind to weak references, and there is need to call rz_removeTarget
 *  or rz_unbindKey before targets or observed objects are deallocated. To achieve automatic cleanup,
 *  RZDB swizzles the dealloc method to ensure observers are properly invalidated. There are other ways of implementing similar
 *  behavior, but this has been found to be both the safest and most reliable in production.
 *
 *  If set to 0 (not recommended), objects MUST remove themselves as targets and unbind their keys from any observed objects before being deallocated.
 *  Failure to do so will result in crashes (just like standard KVO). Additionally, you should not add a target to or bind keys to 
 *  objects without first establishing a strong reference. Otherwise, the foreign object might be deallocated before the observer, causing in a crash.
 *  If you choose to disable global automatic cleanup by setting this to 0, you must cleanup observers manually.
 *
 *  @see rz_cleanupObservers
 */
jkaufman commented 9 years ago

Speaking of, awesome class.

jvisenti commented 9 years ago

Fixed on develop. Will be pushing a new version shortly.