O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

RubyMotion iOS Development Essentials

Book Description

Forget the complexity of developing iOS applications with Objective-C; with this hands-on guide you’ll soon be embracing the logic and versatility of RubyMotion. From installation to development to testing, all the essentials are here.

  • Get your iOS apps ready faster with RubyMotion
  • Use iOS device capabilities such as GPS, camera, multitouch, and many more in your apps
  • Learn how to test your apps and launch them on the AppStore
  • Use Xcode with RubyMotion and extend your RubyMotion apps with Gems
  • Full of practical examples

In Detail

RubyMotion is a revolutionary toolchain for iOS app development. With RubyMotion, you can quickly develop and test native iOS apps for the iPhone and iPad, combining the expressiveness and simplicity of Ruby with the power of the iOS SDK.

"RubyMotion iOS Development Essentials" is a hands-on guide for developing iOS apps using RubyMotion. With RubyMotion, you can eliminate the complexity and confusion associated with the development of iOS applications using Objective-C.

We’ll begin from scratch. Starting by installing RubyMotion, we’ll build ourselves up to developing an app that uses the various device capabilities iOS has to offer. What’s more, we’ll even learn how to launch your app on the App Store!

We’ll also learn to use iOS SDK classes to create application views. Discover how to use the camera, geolocation, gestures, and other device capabilities to create engaging, interactive apps. We’ll develop stunning user interfaces faster with the XCode interface builder and make web apps by using WebView. We’ll then augment applications with RubyMotion gems, doing more by writing less code and learn how to write test cases for RubyMotion projects. Finally, we’ll understand the app submission process to push your app to Apple’s App Store

With "RubyMotion iOS Development Essentials", we will learn how to create iOS apps with ease. At the end of each chapter we will have a tangible and running app, which utilizes the concepts we have learnt in that chapter.

Table of Contents

  1. RubyMotion iOS Development Essentials
    1. Table of Contents
    2. RubyMotion iOS Development Essentials
    3. Credits
    4. About the Authors
    5. Acknowledgement
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Getting Ready for RubyMotion
      1. How can I develop an iOS application?
        1. Native apps using Objective-C
        2. Mobile web applications
        3. Hybrid applications
      2. What is RubyMotion?
      3. Why RubyMotion?
        1. If you are not an Objective-C fan
        2. It is not a bridge
        3. Managed memory
        4. Terminal-based workflow
        5. Easy debugging with REPL
        6. It is extendable
        7. Debugging and testing
      4. Pop quiz
      5. RubyMotion installation – furnish your environment
        1. Prerequisites for RubyMotion
        2. Installing RubyMotion
        3. Update RubyMotion
        4. How do we check we've done everything correctly?
        5. Pick your own editor – you are not forced to use Xcode
        6. How to get help
      6. FAQs
      7. Summary
    10. 2. Instant Gratification – Your First Application
      1. Your first application
      2. Folder structure
      3. Some more goodies
        1. Let's understand the code
      4. Exploring the command line
        1. Motion command – one-stopshop
        2. Rake tasks – get things done fast
        3. Rake file – configuring your application
      5. REPL – the interactive console
      6. Debugger – catch your mistakes!
        1. How to start debugging
          1. While testing on a simulator
          2. While testing on a device
          3. Entering commands before starting
        2. Breakpoint
        3. Listing breakpoints
        4. Moving between the different breakpoints
          1. Checking the value of a local variable
          2. Checking the value of an instance variable
        5. Disable breakpoint
        6. Exit debugger
      7. Summary
    11. 3. Evolution – From Objective-C to RubyMotion
      1. Ruby and Objective-C – a partnership
        1. Ruby and Objective-C share the same ancestor
      2. Interfacing with C and Objective-C
        1. Types
        2. Enumerations and constants
        3. Functions
        4. Structures
        5. Pointers
        6. Classes
        7. Objective-C messages
        8. RubyMotion selectors
      3. Memory management
      4. Summary
    12. 4. Mastering MVC Paradigm
      1. Model-View-Controller (MVC)
        1. Model
        2. View
        3. Controller
      2. The restaurant application
        1. Creating a model
        2. Writing more code
          1. Restaurant controller
          2. Restaurant view
      3. Connecting to an external API
      4. Search restaurant by city
        1. What just happened
      5. Picture speaks louder than words
      6. Play time
      7. Summary
    13. 5. User Interface – Cosmetics for Your App
      1. Bars
        1. The tab bar
          1. Customizing the tab bar
        2. The navigation bar
          1. Customizing the navigation bar
        3. The status bar
      2. Basic UI elements
        1. Label
        2. Textfield
        3. Switch button
        4. Slider
        5. Button
        6. Picker view
      3. Hands-on – add a Restro Application
      4. Summary
    14. 6. Device Capability – Power Unleashed
      1. Camera – smile please!
        1. Camera example
        2. Understanding the Camera code
      2. Location Manager – directions for apps
        1. Location Manager example
      3. Gestures – non-verbal communication
        1. Gesture example
        2. Do it yourself
      4. Core Data – manage your data
        1. Core Data example
          1. Creating an employee
          2. Deleting the employee
      5. Address Book – manage your contacts
      6. Do it yourself
        1. Task 1 – show nearest restaurant
        2. Task 2 – mark each restaurant on a map with a pin
      7. Summary
    15. 7. Interface Builder and WebView – More Goodies!
      1. Interface Builder
        1. Let's try the Interface Builder
          1. .xib to RubyMotion
      2. UIWebView – embed web content
      3. Summary
    16. 8. Testing – Let's Fail Gracefully
      1. Unit testing
      2. Functional testing
      3. Device events
        1. Rotate device
        2. Accelerometer device event
        3. Gestures
          1. Tap
          2. Flick
          3. Pinch open
          4. Pinch close
          5. Drag
          6. Rotation
      4. Summary
    17. 9. Creating a Game
      1. Cocos2D
      2. Let's create a game – Whac-A-Mole
        1. Let's start coding!
          1. Adding motion to moles
          2. Adding touch events to the game
          3. Adding scores
          4. Games without any sounds are boring — let's add some sound
      3. Summary
    18. 10. Getting Ready for the App Store
      1. Generating certificates
        1. Do it yourself
      2. Provisioning profile
        1. App ID
        2. Adding devices
        3. Developer Provisioning Profile
        4. Do it yourself
      3. Setting up the RubyMotion project
        1. Entitlements
        2. Info.plist settings
        3. Building icons
        4. Configuring your application
        5. Installing on a device
        6. iTunes Connect
      4. Creating bundles for submission
      5. Summary
    19. 11. Extending RubyMotion
      1. RubyMotion gems
        1. Teacup – say goodbye to Xcode and XIB files!
        2. BubbleWrap – making Cocoa APIs more Ruby-like
        3. motion-addressbook – access phonebook easily
      2. CocoaPods – managing Objective-C libraries
        1. Installing CocoaPods with RubyMotion
      3. Summary
      4. What next?
    20. Index