Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

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!

Lori M Olson

May 17, 2018
Tweet

More Decks by Lori M Olson

Other Decks in Programming

Transcript

  1. 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
  2. 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.
  3. 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.
  4. 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
  5. 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.
  6. 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…
  7. 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.
  8. So you might be asking yourself - why use RubyMotion?

    Why not Objective C or Swift for your iPhone development?
  9. 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.
  10. 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.
  11. 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.
  12. Back to RubyMotion Back to RubyMotion. Again. Other ways in

    which RubyMotion is different include
  13. 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.
  14. 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.
  15. RubyMotion also provides a “baked in” testing framework (called Bacon

    actually), allowing you to write functional and integration tests for your applications.
  16. 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.
  17. 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.
  18. And… • No, it’s not free* • But you can

    start for free • Yes you have to wait for updates
  19. You had to wait for the next version of RubyMotion

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

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

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

    here today, but you can do fun things with RubyMotion in Android, too.
  23. RubyGems Libraries that provide functions like web access, integration with

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

    project, and keep all the versions compatible
  25. 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.
  26. 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…
  27. 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
  28. But Rails? IT sure would be nice if there was

    a framework like Rails, but for iOS development…
  29. 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!
  30. 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.
  31. 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.
  32. Thanks, WeAreDevs! Presentation (with links) will be available later this

    afternoon on SpeakerDeck.com Lori Olson @wndxlori