Class: RubyMotionQuery::App
Class Method Summary (collapse)
-
+ (UIViewController) current_view_controller(root_view_controller = nil)
Returns the current view controller in the app.
- + (UIApplicationDelegate) delegate
-
+ (Boolean) development?
True if the app is running in the :development environment.
-
+ (String) document_path
Full path of the document folder.
-
+ (Symbol) environment
Environment the app is running it.
-
+ (String) identifier
Identifier of app.
-
+ (String) name
Name of app.
-
+ (Boolean) release?
(also: production?)
True if the app is running in the :release environment.
-
+ (String) resource_path
Full path of the resources folder.
-
+ (Boolean) test?
True if the app is running in the :test environment.
-
+ (String) version
Version.
- + (UIWindow) window
Class Method Details
+ (UIViewController) current_view_controller(root_view_controller = nil)
Returns the current view controller in the app. If the current controller is a tab or navigation controller, then it gets the current tab or topmost controller in the nav.
This mostly works... mostly. As there really isn't a "current view_controller"
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'motion/ruby_motion_query/app.rb', line 79 def current_view_controller(root_view_controller = nil) if root_view_controller || ((window = RMQ.app.window) && (root_view_controller = window.rootViewController)) case root_view_controller when UINavigationController root_view_controller.visibleViewController when UITabBarController current_view_controller(root_view_controller.selectedViewController) else root_view_controller end end end |
+ (UIApplicationDelegate) delegate
23 24 25 |
# File 'motion/ruby_motion_query/app.rb', line 23 def delegate UIApplication.sharedApplication.delegate end |
+ (Boolean) development?
Returns true if the app is running in the :development environment
44 45 46 |
# File 'motion/ruby_motion_query/app.rb', line 44 def development? environment == :development end |
+ (String) document_path
Returns Full path of the document folder
69 70 71 |
# File 'motion/ruby_motion_query/app.rb', line 69 def document_path NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0] end |
+ (Symbol) environment
Returns Environment the app is running it
28 29 30 |
# File 'motion/ruby_motion_query/app.rb', line 28 def environment RUBYMOTION_ENV.to_sym end |
+ (String) identifier
Returns Identifier of app
59 60 61 |
# File 'motion/ruby_motion_query/app.rb', line 59 def identifier NSBundle.mainBundle.bundleIdentifier end |
+ (String) name
Returns Name of app
54 55 56 |
# File 'motion/ruby_motion_query/app.rb', line 54 def name NSBundle.mainBundle.objectForInfoDictionaryKey 'CFBundleDisplayName' end |
+ (Boolean) release? Also known as: production?
Returns true if the app is running in the :release environment
33 34 35 |
# File 'motion/ruby_motion_query/app.rb', line 33 def release? environment == :release end |
+ (String) resource_path
Returns Full path of the resources folder
64 65 66 |
# File 'motion/ruby_motion_query/app.rb', line 64 def resource_path NSBundle.mainBundle.resourcePath end |
+ (Boolean) test?
Returns true if the app is running in the :test environment
39 40 41 |
# File 'motion/ruby_motion_query/app.rb', line 39 def test? environment == :test end |
+ (String) version
Returns Version
49 50 51 |
# File 'motion/ruby_motion_query/app.rb', line 49 def version NSBundle.mainBundle.infoDictionary['CFBundleVersion'] end |
+ (UIWindow) window
18 19 20 |
# File 'motion/ruby_motion_query/app.rb', line 18 def window UIApplication.sharedApplication.keyWindow || UIApplication.sharedApplication.windows[0] end |