Talks
Native iOS Development with RubyMotion and UnderOS
Summarized using AI

Native iOS Development with RubyMotion and UnderOS

by Nikolay Nemshilov

The video features Nikolay Nemshilov discussing native iOS development using RubyMotion and a project called UnderOS. RubyMotion allows developers to create native iOS applications using Ruby, converting the Ruby code into Objective-C, thus providing access to the iOS APIs. UnderOS builds on RubyMotion by transforming traditional mobile development concepts into relatable web development concepts, making it easier for web developers to interface with native iOS frameworks.

Key Points Discussed:
- Background: Nikolay shares his journey as a web developer with 15 years of experience, detailing the challenges faced when transitioning from web development to mobile application development.
- Web vs Mobile Development: He compares web development—which uses HTML, CSS, and JavaScript—to mobile application development, highlighting the struggles Ruby developers encounter due to differing programming paradigms.
- RubyMotion: Introduced as a tool that allows Ruby developers to write native applications without delving deeply into Objective-C or Swift, RubyMotion provides a familiar environment for Ruby developers to create mobile apps.
- UnderOS Introduction: Nikolay explains UnderOS, which abstracts native application concepts to resemble web applications. Each screen in an application is treated like a web page, making it intuitive for web developers to use.
- Live Demo: During the talk, Nikolay live-codes a calculator application using UnderOS, showcasing features such as a CSS-like syntax for layout and real-time adjustments to the user interface, all while using Ruby.
- Seamless Experience: The project bridges the gap between web and mobile application development, allowing Ruby developers to maintain a Ruby-centric design without having to dive deeply into native coding complexities.
- Community and Growth: UnderOS is still growing within the RubyMotion community, and Nikolay invites questions from the audience, emphasizing the potential of UnderOS to democratize native application development for Ruby developers.

Conclusion: Nikolay underlines the importance of creating an approachable platform for Ruby developers who wish to work with native applications, minimizing the learning curve and leveraging the familiarity of web development frameworks.

He encourages developers to explore RubyMotion and UnderOS, highlighting the exciting potential these tools offer in the realm of mobile development.

00:00:27.199 Hi everyone, I'm Nikolai. I came here from Sydney, so I'm going to have a funny accent today.
00:00:34.880 I work for a company called Ninefold, where we do amazing things with hosting for Rails applications, Ruby, and stuff. But in my spare time, I hike around mobile applications, particularly with iOS and RubyMotion.
00:00:41.360 Today, I'm here to talk about one of my projects that's based on top of RubyMotion. I will discuss the story behind this project and do some live coding demos.
00:00:57.360 As a web developer with 15 years of experience, I started looking at web development through HTML and some pieces of JavaScript. I thought, "Hey, this is simple!" There’s a button, an onClick function, and you can quickly get things running.
00:01:09.680 In web development, we have HTML to define the DOM structure, CSS to style things and make them look nice, and JavaScript to make changes to pages and add useful functionalities. The interesting aspect is that these three components—HTML, CSS, and JavaScript—are implemented in different languages.
00:01:36.880 You have pretty much zero chances to mix them together effectively. While you can use inline JavaScript and CSS with HTML, it's generally considered bad practice. However, it is a sustainable model, really extendable, and it grows nicely.
00:01:48.159 On the other end of the spectrum, we have typical desktop development, where everything is written in a single language and compiled down to a native application. In this environment, we have UI libraries where we assign content to components, handle API changes, and attach event listeners. It works great but for web developers transitioning to mobile, especially Ruby developers, it can be a struggle.
00:02:24.400 We are used to certain standards and mindsets in how we implement solutions. Native application development for iOS and Android draws from desktop development principles. This can lead to compromises that end up with something akin to hybrid applications, where you sacrifice performance and ease of integration for the sake of retaining familiar development patterns.
00:03:05.639 This is where RubyMotion comes in. RubyMotion is a project created by one of the ex-Apple employees, which essentially acts as a compiler that converts Ruby into Objective-C. This allows you to write native applications entirely in Ruby, providing access to native APIs for file systems, networking, OpenGL, and more. The benefit is that it feels more familiar to Ruby developers, aiding in the learning curve.
00:04:07.680 However, despite making everything 100% Ruby, developers need to deal with native APIs, which can come with a sizeable learning curve. Concepts may be completely different; for example, even a simple task such as creating a button can seem daunting. You have to study the API specifications and figure out how to attach events properly.
00:05:24.320 This is where my project begins. I want to create an abstraction over native applications, treating them more like web applications. Each application on a phone can be likened to a website. When you tap an icon on your phone, it’s similar to entering a URL in a web browser. Multiple screens within an application can represent multiple web pages on a server. Based on this analogy, I aim to build an interface that is familiar to web developers.
00:06:36.480 This idea allows us to treat native applications as if they were web apps. While it's not truly web-based—it’s still a native application—the conceptual design resembles that of a web browser, making it intuitive for web developers to interact with. Ultimately, the project compiles everything into a native app while offering easy native API access.
00:07:57.840 I built this project called UnderOS, which I’m excited to demo. The UnderOS project is available as a Ruby gem. You can install it and then use it to create templates for RubyMotion applications. Everything from layouts that resemble HTML to stylesheet files that resemble CSS is found here.
00:08:39.680 Each screen within your application is treated as a conceptual web page containing a context written with a kind of DSL that resembles JavaScript. For instance, you can define a layout with a button and use CSS to position it. I believe it’s important to show you this in action, so let’s build a calculator application together.
00:09:50.480 To start, we will add a label to show results. From here, we can add buttons, positioning them in rows and columns easily with the CSS-like syntax. As we code, we will also adjust styles to enhance the visibility and layout of the calculator.
00:12:07.680 After compiling everything, the application should start looking like the calculator we envisioned. We will have to set a label for the result, which by default is positioned at zero. I will show you how we can quickly adjust the UI in real-time using a console where we can manipulate styles and attributes using a Ruby-like syntax.
00:14:01.600 This real-time feedback makes it exciting, and you can witness just how intuitive it is for Ruby developers. The syntax feels natural, and you can craft your user interface with ease. I will also detail the event handlers, building up the logic behind how our calculator processes input and performs calculations.
00:15:58.720 As tasks are completed, it’s remarkable to see how all of this is achieving a smoothly functioning calculator—all developed purely in Ruby. Nothing native has been touched yet; it's an entirely Ruby-centric experience.
00:17:31.840 In summary, this approach allows Ruby developers to feel at home, minimizing the learning curve while maximizing accessibility to native APIs. Throughout the development process, the interaction appears seamless, and anyone with a web-focused background can easily adapt.
00:18:22.720 The goal of the UnderOS project is to provide the familiarity of web development within the context of mobile applications while still retaining the performance and capability of a native app. It stands as a tool to help bridge the gap between web and native development for Ruby developers.
00:19:41.440 As we continue to evolve this framework, we strive to ensure web developers can effectively use it to construct their applications without the overwhelming intricacies of native coding.
00:20:03.840 Now, in this talk, I welcome any questions you may have regarding UnderOS or RubyMotion. As it stands, the community surrounding UnderOS is still growing.
00:21:51.360 Although it is known within the RubyMotion community, being a commercial project that requires a license fee means it isn't particularly large. That said, it has great potential for developers aiming to create native applications without the steep learning curve typically associated with this space.
00:22:33.760 In closing, I appreciate your attention and hope you explore the potential of RubyMotion and UnderOS. There’s much excitement ahead as we continue to grow and develop this project further.
Explore all talks recorded at Rocky Mountain Ruby 2014
+18