RubyMotion Debugging

One of the nice things about RubyMotion is the REPL. Below is the code I paste in the REPL to get an instance of the current view controller.

vc = UIApplication.sharedApplication.delegate.instance_variable_get("@window").rootViewController.topViewController

You can then access any public properties on the class that are exposed with attr_accessible or by using a custom getter and setter. If you have not specified any properties for your instance variables you can use the instance_variable_get helper to access the internal instance variables.

Leave a comment


email* (not published)