Heating up with HotCocoa on GitHub
I’ve imported Postie to GitHub to make it easier to follow along from home. If you’re new here, you can see the development of Postie in the Heating up with HotCocoa articles (part I, part II and part III).
The code on GitHub is based off of the code from part III with a minor addition to the button action.
b.on_action do
load_feed
@timer.invalidate unless @timer.nil?
@timer = NSTimer.scheduledTimerWithTimeInterval(30, target:self,
selector:"refresh".to_sym, userInfo:nil,
repeats:true)
end
I wanted to have the application reload my metrics data automatically to feed my
obsessive nature. I added a NSTimer
that will execute a refresh
method
every 30 seconds. The refresh method just calls load_feed
to reload
everything. Not perfect, but works as a quick hack to be cleaned up later.