RubyMotion

Summarized using AI

Lightning Talk: RubyMotion

Colin Thomas-Arnold • October 26, 2012 • Earth

In this lightning talk presented at the Rocky Mountain Ruby 2012 event, Colin Thomas-Arnold provides an in-depth overview of RubyMotion, a tool that compiles Ruby into native iOS code, allowing developers to create apps without relying on the typical Matz's Ruby interpreter. Colin outlines the essentials to get started with RubyMotion, highlighting the simplicity of the setup, which requires just a terminal and a text editor, avoiding the use of Xcode.

Key points discussed in the talk include:

  • Introduction to RubyMotion: RubyMotion is designed for Ruby developers, providing a way to write native iOS applications in Ruby.
  • Installation and Configuration: After installing RubyMotion, developers can utilize the 'motion' command to create new projects easily. Colin demonstrates this by creating a gem file and a Rake file.
  • Project Structure: He explains the common structures in iOS apps and demonstrates how to create an app delegate and a controller, blending Ruby code with iOS architecture.
  • Using Teacup: As the lead developer on Teacup, Colin illustrates its functionality, likening it to a CSS stylesheet for Ruby applications. This tool allows for the styling of components, making the UI setup straightforward.
  • Code Examples: Colin shows example code snippets, emphasizing the conciseness of Ruby compared to Objective-C, particularly in navigation and view management. By using blocks and simplified syntax, developers spend less time coding repetitive elements.
  • Engagement with the Audience: Throughout the presentation, Colin encourages attendees to engage with him after the talk, fostering a community among RubyMotion developers.

Colin concludes by inviting fellow developers to discuss RubyMotion with him, aiming to build connections within the RubyMotion community. The key takeaway from this talk is that RubyMotion empowers Ruby developers to efficiently build native iOS applications, combining familiar Ruby syntax with essential iOS structures, thus significantly simplifying the development process.

Lightning Talk: RubyMotion
Colin Thomas-Arnold • October 26, 2012 • Earth

Help us caption & translate this video!

http://amara.org/v/FGgk/

Rocky Mountain Ruby 2012

00:00:05.550 Hi, I'm Colin Thomas-Arnold. I've been using RubyMotion since the day it was announced, and my goal today is to give an overview of what to do after you have downloaded it. That's usually the first question people ask. My handle is Colin ta on most platforms, and I reply to it. I am a RubyMotion architect and also administer the GitHub organization for RubyMotion.
00:00:16.049 So what is RubyMotion? RubyMotion compiles Ruby into native iOS code. It does not run Matz's Ruby interpreter or any interpreter at all; you end up with a compiled executable that can be submitted to the App Store. This is significant because nobody knows the difference. It’s very cool! The stack you need is simple: just a terminal and an editor. You do not have to use Xcode—I don’t, and I won’t during this talk.
00:00:52.530 I have a couple of sites open: my personal site, Colin ta, and a project called SweetTea, which is a combination of a couple of plugins. I’m also the lead developer on Teacup, which I'll be showing. The RubyMotion organization includes BubbleWrap, SugarCube, Teacup, and an underdevelopment website. When you get started with RubyMotion, you'll find that BubbleWrap and SugarCube are two essential gems—they wrap Objective-C code for you.
00:01:44.160 Installing RubyMotion provides you with the 'motion' command, which allows you to create a new project easily. Your usual toolset will feel very familiar. I'll create a gem file right now. I use Sublime Text, but I used TextMate for so long that I still use the 'mate' command to open files—old habits die hard! You end up with a gem file like the ones you're used to, and you also have a Rake file that gets compiled when you run 'rake'. We will see RubyMotion in action once we update it.
00:02:05.729 Now, let's have a look at what we have here. With 'rvm', you'll notice that many of the same tools are in play. The new version of RubyMotion has just been released, which is exciting! So now, compiling the app, here’s what our app currently looks like. We have an app delegate, and if you've worked with iOS, you’ll be familiar with this structure. This is a low-level approach, where you create the window manually and activate it. It throws an error right now, but that’s because we haven’t implemented any functionality yet.
00:03:04.380 I am going to create a controller; it won't do much at first. I will hand it to a navigation controller, and now we are starting to see a mix of iOS code and Ruby code. If you'll recognize Objective-C code and how it looks, you'll understand this transition. Now let's see how I'll use Teacup. Teacup works like a stylesheet, so I will define one and create an empty stylesheet for now. I will manually set up my views, something Xcode typically does for you.
00:05:06.250 I create a button, style it, and you'll notice this resembles CSS, but it’s all running in Ruby. We set dimensions and other properties in a similar way. Now looking at the app delegate again, I’ll assign my first controller. I will assign a handler to it, using a block. For reference, the Objective-C equivalent would typically involve more typing, such as implementing 'navigationController.pushViewController'. In RubyMotion, we abbreviate this process considerably. The final steps will show that I did write an app.
00:05:46.199 If you're interested in RubyMotion, please come talk to me afterward. I'd love to meet fellow RubyMotion developers!
Explore all talks recorded at Rocky Mountain Ruby 2012
+16