With the arrival of the iOS family of devices, the direction of software development has radically changed. Today people are spending considerable amounts of time on smart devices instead of PCs, which is generating an unprecedented amount of revenue that no industry has ever seen. Despite this, it still fits in your pocket.
So far the application development scene for the iOS ecosystem has been dominated by Objective-C. However, with the introduction of the revolutionary RubyMotion tool chain, Ruby developers are no longer outcasts for creating pure native iOS applications. They can make use of every bit of the all-powerful iOS SDK; and the best part is this can be done without using Xcode.
Both Ruby and RubyMotion are the brainchild of folks who wanted to simplify things in a complex world. Yukihiro Matsumoto (also known as Matz) is credited for creating the Ruby programming language, which is often regarded as a developer's best friend. And Laurent Sansonetti is credited for creating the ground-breaking tool chain, RubyMotion.
RubyMotion iOS Development Essentials will appeal to a developer's mind, especially to the technocrats looking for a reliable tool chain for iOS development. This book] is a step-by-step guide to build an iOS application from scratch to deployment.
Chapter 1, Getting Ready for RubyMotion, gets you acquainted with RubyMotion. Here, we will start with an introduction to RubyMotion, followed by detailed installation steps.
Chapter 2, Instant Gratification – Your First Application, explains how to create a simple Hello World application and also the structure of RubyMotion applications in general.
Chapter 3, Evolution – From Objective-C to RubyMotion, helps you understand the journey from Objective-C to RubyMotion. This chapter is also a quick guide to understanding the RubyMotion syntax corresponding to its Objective-C syntax.
Chapter 4, Mastering MVC Paradigm, focuses on writing better code with the Model-View-Controller architecture. We will also learn about connecting the application to an external API.
Chapter 5, User Interface – Cosmetics for Your App, describes how the user interface is a key part of an iOS application. Also, this chapter explains how we can use the various user interface elements.
Chapter 6, Device Capability – Power Unleashed, teaches you how to use various device capabilities, such as Camera, Location Manager, Gestures, Core Data, and Address Book. We will create sample applications for each one of them to understand them better.
Chapter 7, Interface Builder and WebView – More Goodies!, explains how to use the interface builder and
UIWebView with RubyMotion applications.
Chapter 8, Testing – Let's Fail Gracefully, discusses Unit Testing and Functional Testing in a RubyMotion application by following the philosophy of Test-driven Development.
Chapter 9, Creating a Game Application, helps you create a popular arcade game, Whack-a-Mole, using Cocoa2D and RubyMotion. This is one of the most exciting and unique features of working with RubyMotion where it's possible to create graphical gaming applications.
Chapter 10, Getting Ready for the App Store, explains the process of submitting a RubyMotion application to the Apple App Store.
Chapter 11, Extending RubyMotion, describes how to augment our RubyMotion applications by making use of the already available open source gems, such as TeaCup, BubbleWrap, and Address Book.
To program with RubyMotion, firstly you require a Macintosh computer. Since RubyMotion is proprietary software, you are required to buy its license from http://sites.fastspring.com/hipbyte/product/rubymotion.
This book is for developers who are well versed with the Ruby programming language, and are interested in developing native iOS applications. We do not expect you to have any prior knowledge of RubyMotion. With RubyMotion iOS development essentials, we will discover features of this amazing tool chain from beginner to pro level.
Prior knowledge of Objective-C and the iOS SDK can come in handy at times, but no worries, we have covered every little detail to make you a maven by the end of this book.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Create a
contact_us_controller.rb file inside the
A block of code is set as follows:
@submit_button.addTarget(self, action:''send_message'', forControlEvents:UIControlEventTouchUpInside)
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
def setupNavigationBar back= UIBarButtonItem.alloc.initWithTitle(''Back'', style:UIBarButtonItemStylePlain,target:nil ,action:nil) self.navigationItem.backBarButtonItem = back; contact_us_button = UIBarButtonItem.alloc.initWithTitle(""Contact Us"", style:UIBarButtonItemStylePlain ,target:self, action:""contact_us"") self.navigationItem.rightBarButtonItem = contact_us_button end def contact_us contact_us_controller = ContactUsController.alloc.initWithNibName(""ViewController"", bundle:nil) presentModalViewController(contact_us_controller, animated:true) end
Any command-line input or output is written as follows:
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes, for example, appear in the text like this: "Open Xcode and click on Create a new Xcode Project."
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to
<[email protected]>, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at
<[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at
<[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.