github/ReactiveCocoa — pull request #163 by Coneko (2012-12-03 03:45:49+00:00)
Title: Two-way binding.

**NOT READY FOR MERGING**

Just throwing down some ideas.

Uncertain about the naming of the methods. "Two-way binding" is a mouthful so I opted for "sync" as a synonym. Might cause confusion.

Still missing the cross-thread tests. Unsure if adding `-deliverOn:` in the transformation blocks is enough. Is `-addObserver:` thread-safe? Is it thread-safe to observe a non-threadsafe object from a different thread?

Basic idea is to keep an atomic version counter and two inhibitor flags in a closure that contains both `-rac_addObserver:forKeyPath:options:queue:block:` blocks. Use the atomic version counter to make sure last update across threads always wins, loser gets ignored. Use inhibitor flags to cancel the echo from syncing a property.

Input appreciated.