KVO on an App::Persistence key/value

15 views
Skip to first unread message

bwla...@gmail.com

unread,
Jan 23, 2014, 10:06:37 AM1/23/14
to bubbl...@googlegroups.com
Is there a way to do a KVO observe on an App::Persistence key/value combination?

Colin T.A. Gray

unread,
Feb 27, 2014, 12:39:12 PM2/27/14
to bubbl...@googlegroups.com
Yes, NSUserDefaults is KVO compliant, so you can use the BW::KVO module to observe changes to it's keys.

    observe(App.notification_center, 'key') do |old_value, new_value|
    end

Just be sure to unobserve the value later (the README doesn't mention this, but I'm worried there's a memory leak lurking there)
Reply all
Reply to author
Forward
0 new messages