REPL

Rubymotion has an interactive console (REPL - Read-eval-print loop) very similar to irb that allows us to launch an app, and to execute some code in a real-time, without rebuilding the app. Try to launch the app from your terminal with rake, wait when it will get launched, and try to use the console as usual:

        x = 10
        y = 20
        x * y
        # => 200
      

You can create and show screens, show alerts, and do whatever you want right there in your console. Let's try to present an alert view for example:

        app_delegate = UIApplication.sharedApplication

        alert = UIAlertView.alloc.initWithTitle "Hi",
          message: "I'm alert view!",
          delegate: app_delegate,
          cancelButtonTitle: "Cancel",
          otherButtonTitles: nil

        alert.show
      

Book Index | Next