News

 
  • 01 Nov

    New in RubyMotion: Mavericks, #eval for OS X, Instruments, Xcode Asset Catalogs

    New functionality arrived in RubyMotion, let’s cover what’s new!

    OS X 10.9 Mavericks

    RubyMotion is now fully compatible with OS X’s latest release, Mavericks. The iOS toolchain works on Mavericks and you can also create Mavericks OS X apps with it.

    In case you have been waiting for the green light to update: feel free to do so now! Make sure you also grab the latest Xcode from the App Store and install the command-line tools.

    The RubyMotion toolchain still supports 10.6 Snow Leopard but we highly recommend upgrading to a newer version of OS X at this point.

    #eval for OS X

    Originally, RubyMotion was iOS-only and the #eval method was not implemented by design, as we did not want RubyMotion apps to interpret/compile code at runtime on iOS devices.

    Now, RubyMotion can be used to make OS X apps and Macs do not have the same constrains as iOS devices. Therefore, we are making #eval optionally functional for OS X projects.

    In order to enable #eval for your OS X project, you can set the app.eval_support variable to true in your Rakefile.

    Motion::Project::App.setup do |app|
      ...
      app.eval_support = true
    end
    

    Enabling #eval will copy the RubyMotion JIT compiler inside your application’s bundle, increasing its size by 28MB.

    Please note that #eval support for OS X is experimental and is not properly optimized in terms of runtime speed and memory usage, so use it carefully and report us any problem you find!

    Instruments

    The RubyMotion build system now exposes a set of Rake tasks to profile your project with Apple’s Instruments application. Symbols metadata (such as source file/line) are also integrated.

    On iOS, the rake profile:simulator and rake profile:device tasks can be used to attach Instruments to either your application running in the iOS simulator or in your iOS device. By default, rake profile will target the simulator.

    $ rake profile # same as profile:simulator
    $ rake profile:device
    

    On OS X, the rake profile task will attach Instruments to a development build of your OS X project.

    All tasks will profile a development build of your project, making it easy to get going and not have to deal with code-signing. However, before submitting your application to the App Store we recommend you profile a release build instead. For this you can use the rake profile:release task for OS X apps or set the mode environment variable to release for iOS apps:

    $ rake profile mode=release
    

    When Instruments.app starts you will have the ability to select a template that should be used for the profiling session. The Allocations template can be used to measure memory allocations and the Time Profiler template will sample the runtime activity of your process.

    In case you would like to configure the template that should be used from the command-line, you can set a value for the template environment variable.

    $ rake profile template="Time Profiler"
    

    Xcode Asset Catalogs

    Since RubyMotion 2.11 we have introduced support for Xcode Asset Catalogs.

    These allow you to manage your image assets without having to name your image assets with the many filename modifiers required to support the various devices (e.g. @2x, ~ipad, etc). When an asset catalog is placed in the resources directory of your project, RubyMotion will automatically compile it into your application and you can simply reference the assets by their base names.

    Currently RubyMotion supports general image sets and application icon image sets, launch image set support is still forthcoming.

 
 

Want to stay in touch?

Follow us on Twitter