lib/lotion/application.rb in lotion-0.0.1 vs lib/lotion/application.rb in lotion-0.1.0

- old
+ new

@@ -1,9 +1,39 @@ +#= require lotion/command +#= require lotion/notifications + module Lotion module Application - extend Lotion::Concern + include Lotion::Notifications - def application( application, options ) #didFinishLaunchingWithOptions:launchOptions - true + ## + # + def screen + UIScreen.mainScreen + end + + ## + # + def window + @window ||= UIWindow.alloc.initWithFrame screen.bounds + end + + ## + # + def on( name, command ) + notification_center.addObserver command, + selector:'call:', name:name, object:nil + end + + ## + # + def views + @views ||= Hash.new { |h, k| h[ k ] = k.alloc.init } + end + + ## + # + def application( application, didFinishLaunchingWithOptions:launchOptions ) + notify 'application:startup', launchOptions end end end