Pro Yearly is on sale from $80 to $50! »

RubyMotion - Mobile & Beyond

RubyMotion - Mobile & Beyond

Presented at We Are Developers 2018 - Vienna Austria

The intention is to introduce, or reintroduce, RubyMotion to the mobile developer. Lots of devs were turned off in the early days, due to the pay-to-play requirement, and the lack of infrastructure. RubyMotion is a LOT more fun to use these days, with a free option, several frameworks to play with, and ANDROID support.

At the end, developers should feel comfortable with the basic toolset, and have just enough knowledge to be dangerous... that is to say, dangerously close to producing their own native apps!

B36ea58289890176b6170e382b3194fe?s=128

Lori M Olson

May 17, 2018
Tweet

Transcript

  1. RubyMotion Mobile & Beyond Presented by Photo by Henk on

    Unsplash
  2. Lori Olson Developer, trainer, mentor and now founder of the

    WNDX School
  3. Why RubyMotion?

  4. Well, because RubyMotion IS Ruby.

  5. http://www.rubymotion.com/tour/how-it-works/ Ruby is a dynamic, open source programming language with

    a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. (http://ruby-lang.org) Since I won’t assume that you are all familiar with ruby, let’s explore ruby just a bit before proceeding
  6. Ruby vs Rails Let’s just address this confusion people sometimes

    have about Ruby vs Rails
  7. Ruby is to Rails

  8. Python is to Django

  9. PHP is to Laravel One is a language the other

    is a framework
  10. about Ruby

  11. Ruby Philosophy To make programmers productive and happy Photo by

    Brooke Cagle on Unsplash
  12. Everything is an Object What does that mean?

  13. Number 1 2.to_s 3.next 4.days 5.months

  14. DSL’s DSL’s or Domain Specific Languages Ruby is ideally suited

    to the creation of DSL’s and so they abound in the Ruby eco-system. Take for example.
  15. Rake Rake is Ruby’s build tool. The equivalent of ‘make’.

    It is also used as the RubyMotion build tool, so you can customize your project’s build any way you like. The great thing about DSL’s is that you can make it very specific to the task at hand.
  16. desc "One line task description" task :name_of_task do # Your

    code goes here end rake name_of_task This is an example of a trivial Rake task
  17. desc "Example of task with parameters and prerequisites" task :my_task,

    [:first_arg, :second_arg] => ["first_task", "second_task"] do |t, args| args.with_defaults(:first_arg => "Foo", :last_arg => "Bar") puts "First argument was: #{args.first_arg}" puts "Second argument was: #{args.second_arg}" end rake my_task[one,two] This is a more advanced Rake task. But the important thing to note about Rakefiles, is that they are just Ruby. So you can drop extra methods and stuff in where they are needed.
  18. Iterators Photo by Dmitri Popov on Unsplash The iterators in

    Ruby are a thing of beauty
  19. response = gets.chomp.downcase validInput = false # Flag to track

    if input is valid i = 0 #Index for following loop while i < titles.length do validInput = true if response == titles[i] i += 1 end validInput = true if response == "back" I’ll give you an example here. This is a bit of code that my new first-year co-op student wrote, a fragment from his first real Ruby program. And I looked at it, and you can just see his C++ leaking out everywhere…
  20. response = gets.chomp.downcase valid_input = titles.include?(response) || response == “back"

    The Ruby standard library is filled with iterators like include? in which the loop is assumed.
  21. Why RubyMotion? Getting back to RubyMotion again…

  22. So you might be asking yourself - why use RubyMotion?

    Why not Objective C or Swift for your iPhone development?
  23. Swift • Moving fast • Breaking things Swift is a

    nicer language, by far, than Objective C. It’s main problem is that it has been evolving very, very fast. When a new major release happens *every year* that means you, as a developer, have to update all your apps *every year* for these breaking changes. That level of change imposes a burden that might not be sustainable for every app or developer.
  24. Ruby • More frequent updates • Fewer breaking changes •

    Over 25 years old, current version 2.5.1 That’s not to say there are never any incremental updates that cause problems. But the Ruby Language group concentrates on evolutionary, not revolutionary change.
  25. Yukihiro Matsumoto creator of Ruby By using Ruby, I want

    to concentrate on the things I do, not the magical rules of the language, like starting with public void something something something to say, "print hello world." I just want to say, "print this!" Speaking of Matz, or Yukihiro Matsumoto, the creator of Ruby *most Ruby developers just call him - MATZ* Matz once said: For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative side of programming, So Ruby is designed to make programmers happy. And I have to confess, having used Objective C long before iPhones even existed, I can’t say there’s anything resembling “happy” involved in programming with Objective C.
  26. Back to RubyMotion Back to RubyMotion. Again. Other ways in

    which RubyMotion is different include
  27. When creating a RubyMotion application, you use simple command-line tools

    from your terminal. And, you will not be trapped within Apple’s Xcode environment, which is not going to win any prizes as the developers’ favorite IDE. This also makes the RubyMotion environment a friendly accessible environment.
  28. RubyMotion comes with a REPL - read - evaluate -

    print - loop. This REPL allows you to write code in the console, and see changes in real time in your running application, making it simple to experiment and iterate.
  29. RubyMotion also provides a “baked in” testing framework (called Bacon

    actually), allowing you to write functional and integration tests for your applications.
  30. Identifying developer pain points, like provisioning for the deployment of

    applications, RubyMotion has also provided supporting libraries like motion- provisioning and motion-appstore to help you deploy to real devices on one hand, and upload your completed app to the Apple App Store on the other.
  31. RubyMotion IS native. This is different. Ruby is a language

    with many implementations - MRI, JRuby for the JVM, mruby for embedded applications with it’s own compiled bytecode.
  32. And… • No, it’s not free* • But you can

    start for free • Yes you have to wait for updates
  33. For example, when Apple unveiled their new MacBook Pro with

    touch bar on Oct 27th, 2016…
  34. You had to wait for the next version of RubyMotion

    to get touch bar support… until Oct 28… one day.
  35. Starter is limited to iOS and Android, and just this

    latest release, macOS. Splash screen No betas or old versions. Only current version supported.
  36. iOS + macOS + (watchOS + tvOS) *watchOS and tvOS

    only available in the Indie or Professional versions
  37. And Android! We won’t really be addressing the Android support

    here today, but you can do fun things with RubyMotion in Android, too.
  38. Ruby Tools! And, you get to use all the familiar

    Ruby tools!
  39. Rake We already discussed

  40. RubyGems Libraries that provide functions like web access, integration with

    social media, Mapping, data access, screen layout, and much much more
  41. Bundler Bundler helps pull all those gems together in your

    project, and keep all the versions compatible
  42. No Xcode Required You do not NEED to use Xcode,

    however, you need it installed. Boo. The command-line tools and simulators are all hiding under the covers of Xcode.
  43. Your fav editor You can use whichever editor you like.

    If you like Vim, use that. Or if you prefer use Emacs, Sublime Text, or even a full featured IDE with RubyMotion support like RubyMine…
  44. http://motion-toolbox.com Speaking of gems

  45. motion-cocoapods And if you can’t find a gem to do

    what you want, there’s always CocoaPods, and motion-cocoapods, Your handy-dandy interface to all the Objective-C libraries that others have created for iOS development
  46. So many gems http://www.mywebpresenters.com/articles/wp-content/uploads/2012/08/choosing-a-corporate-video-production-company.jpg But there are so many gems?

    It might be hard to figure out which ones to use…
  47. But Rails? IT sure would be nice if there was

    a framework like Rails, but for iOS development…
  48. the RubyMotion community has combined and tested the most active

    and powerful gems into a single package called RedPotion And so there is. http://docs.redpotion.org/en/latest/ ProMotion, RMQ, CDQ, AFMotion, RedAlert, and MORE!
  49. Live demo time

  50. As an educator, I like to leave some things as

    an exercise for those who are interested. You can add those “waiting” indicators, fix the display of the temperatures, or I’m certain you’ll come up with other creative additions to this example. The WNDX School, my school, would like to help YOU get off to a GREAT start with RubyMotion.
  51. RubyMotion JumpStart • *class will open on May 25* •

    Sign up *today* • https://wndx.school • http://bit.ly/ rubymotionwearedevs Our Introductory workshop, featuring RubyMotion & RedPotion will get you going from installation and setup of RubyMotion, generating your first application screens, adding user interactions and navigation, data models, populating your data store from a remote source, and getting that app up and running on your own device. Use the link below to get an *instant* discount on this workshop. I hope to see you there.
  52. Thanks, WeAreDevs! Presentation (with links) will be available later this

    afternoon on SpeakerDeck.com Lori Olson @wndxlori