Monthly Archives: September 2014

Issue #45

Xcode 6 and iPhone 6 fixes

RubyMotion 2.34 was released this week, fixing various problems we’ve been having using new iPhones and Xcode. Go grab and test it.

HipByte released new renewal pricing. What are your thoughts about that?


If you missed the last issue, you can find it here: issue #44.

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


September 26th, 2014 | blog post | by Alex kakubei
The Disappointement of Rubymotion

September 25th, 2014 | blog post | by RubyMotion
RubyMotion for Android and Renewals Pricing

September 24th, 2014 | blog post | by Jordan Maguire
Should my company choose RubyMotion or Swift?

September 24th, 2014 | slides | by Paul Campbell
You’re More Powerful Than You Think

September 23th, 2014 | blog post – Japanese | by Satoshi Watanabe
I try using the listLiew in RubyMotion for Android

September 23th, 2014 | blog post | by Kieran Andrews
RubyMotion Android Beta Tip

September 23th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 44 – Converting Between Android with Java and Android with RubyMotion

September 23th, 2014 | blog post | by Luke Cathie
RubyMotion & Google iOS SDK

September 22th, 2014 | blog post | by Jamon Holmgren
Building iOS forms the ProMotion way with ProMotion-form

September 20th, 2014 | blog post – Japanese | by Fumihiko Shiroyama
I try using the RubyMotion for Android

September 19th, 2014 | new gem | by Qi He
motion-wechat – Rubymotion gem to easily use WeChatSDK

RubyMotion News


RubyMotion 2.34 released

  • All iOS and OS X versions of the runtime have been recompiled with Xcode 6.
  • [iOS] Add support for iPhone 6/6+ launch images. Unless explicitly
    specified, the Info.plist UILaunchImages key is populated from all PNG
    files in the resource directories that start with Default. For iPhone 6/6+
    use the -667h and -736h filename modifiers.
  • [OSX] Fix a bug that made it impossible to build a OS X app on Yosemite
    with Xcode 6 GM, even when targeting 10.9.
  • Fixed a bug that omitted class and protocol methods from the ctags.
    Patch by Rakesh BS.
  • Improved exception backtrace symbolication performance by ensuring the dSYM
    bundle is used when available.
  • Improved Enumerable#inject performance. ~40% times faster.
  • Fixed a bug that could cause clang++ to be called with too many arguments
    for a shell to handle.
  • Fixed a bug that could cause gen_bridge_metadata to be called with too
    many arguments for a shell (on Yosemite) to handle.
  • [OSX] Fixed a bug that made it impossible to use a NSApplication subclass.
  • [OSX] Fixed a bug where it would trigger a crash when it will evaluates a
    expression on REPL on Yosemite.
  • [OSX] Fixed a bug where the build directory for 3rd-party library wouldn’t
    be removed with rake clean command.
  • [OSX] Fixed a bug where it didn’t handle NSTaggedPointerString objects
    when it configured lower OS X version as deployment target on Yosemite.
  • [OSX] Fixed a bug where rake debug=1 freezes lldb with Xcode 6 GM.
  • [iOS] Changed default simulator to ‘iPhone 6’ which it would be introduced
    by Xcode 6 GM.
  • Fixed a bug where Instruments didn’t launch if it would specify a template
    name with “rake profile template=’xxx'”.
  • Fixed a bug where Method#owner will return incorrect owner if the method
    in inherited class would be overrided.
  • Fixed a bug where wrong method would called when it would include module
    which have #viewWillAppear and #viewWillDisappear implementations.
  • Fixed a bug where method would not called when it would include some module
    which have #viewWillAppear implementations.
  • Fixed a bug where #method_missing would receive incorrect arguments after
    calling was cached.
  • Fixed a bug where the build system would ping the update server for each
    target an application project includes.
  • Fixed a memory leak which was created when huge splat would be passed into
    the methods since second argument.
  • Improved Regexp.last_match performance. ~20% faster.

sudo motion update

RubyMotion App of the Week


image

tunedup – by By Sam Bauch

“tunedup is for discovering new music. We play a song clip. swipe right if you like it. swipe left if you don’t. Listen to full songs on Spotify, and login with Spotify to save your favorite songs to a tunedup playlist. We keep track of your likes and dislikes and try to recommend music you might like.”

Gems used:

  • MotionKit
  • AFMotion
  • motion-config-vars
  • sugarcube
  • bubblewrap (core & media)

Pods used:

  • JMImageCache
  • Bolts (for App Links Navigation Protocol – particularly interested in this area of inter-app nav/communication)
  • Mixpanel
  • New Relic
  • MBProgressHud

Also:

  • Spotify framework SDK
  • Apple’s ImageEffects+ library
  • Tapstream – they offer a neat solution for custom onboard links where you can customize first run experience based on the link a user tapped to install the app.

RMQ News


RMQ Edge and SDK 8

If you’re using SDK 8 and use RMQ in landscape, you will want to use RMQ edge. Replace your RMQ gem in your gemfile with this:

gem 'ruby_motion_query', :git => 'git@github.com:infinitered/rmq.git'

We’ll be releasing RMQ v0.8.0 soon; a small but important upgrade. Landscape is great now, before it was meh.

Sponsor


My company InfiniteRed sponsors this newsletter by allowing me the time to work on it every week and hosting everything.

Contact us if you ever need help working on a project, mentoring, or other development services . We specialize in RubyMotion and have an awesome team.

image


If you have any tips, blog posts, or comments, please send emails to todd@infinitered.com

Issue #44

When it rains it pours

People in long lines at the Apple stores (my local store), iPhone 6 shipped today (mine is in a FedEx truck out for delivery, please hurry, we’re running out of oxygen), iPhone 6++ and its awesome camera, RubyMotion beta for Android (that is referred to as burying the lead), automatic update to Xcode 6 (thanks Apple for ruining my morning by breaking my builds), iOS 8 rollout, RubyMotion 2.3 released (minor update), Mark Rickert left his lake “house” and now is at a McDonalds in an unknown city (well I know, but you can’t make me talk), We don’t have to change our apps to Euros for Scotland. Did I miss anything?


If you missed the last issue, you can find it here: issue #43.

Happy coding, Todd Werth (@twerth)

RubyMotion News


Public Beta of RubyMotion for Android

image

Read about it here.

A free screencast about setting everything up.

Examples.

RubyMotion 2.33 released

  • Added support for installing pre-releases of RubyMotion. The
    sudo motion update --pre command will install a pre-release build in
    /Library/RubyMotionPre. Currently, the pre-release channel contains
    the first beta of RubyMotion for Android. Enjoy! ^_^

sudo motion update

RubyKaigi 2014 Discount (15% off)

Go here.

Articles, News, New Gems, and Blog Posts


September 23th, 2014 | meetup | by Ruby Ireland Meetup
RubyMotion Ireland – Paul Campbell present an introduction to rapid native iOS app development using Ruby with RubyMotion

September 18th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 43 – The Raw Experience of Setting Up RubyMotion for Android

September 18th, 2014 | blog post | by Mark Rickert
Prepending the Default RubyMotion Build Task

September 17th, 2014 | slides – Japanese | by Katsuyoshi Ito
CDQ for the first time

September 17th, 2014 | slides | by Sotaro Omura
RubyMotion もくもく会 in Osaka

September 17th, 2014 | blog post – Japanese | by Y.Kentaro
No headers to parse

September 17th, 2014 | interesting tweet | by Ivan Acosta-Rubio
Laurent Introducing Android beta at RubyMotion Kaigi 2014

September 16th, 2014 | blog post | by RubyMotion
Announcing the public Beta of RubyMotion for Android

September 15th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 42 – Objective-C Basics and Conversion

September 15th, 2014 | new gem | by Qi He
Rubymotion Geocoder wrapper!

RubyMotion App of the Week


image

K2 Poker – by By Stuart Hanscombe

“K2 Poker, become the King of Poker by winning an imaginary $1 Million, starting with just $1 double your way up the mountain of cash by playing everybody’s favorite Poker game, with the added twist of being able to burn your cards along the way. You have been given the advantage, use it wisely.”

Gems used:

  • RMQ => Layout / Stylesheets, event handling, animations.
  • Formotion => settings Page
  • Bubble-Wrap => Sounds
  • Motion-Social => Sharing functionality.

Non RubyMotion gem:

  • Ruby-Poker

Hidden Gem by Gant Laborde


RM Loop Efficiency

We’re all familiar (at least I assume) with ways to loop n times in Ruby.

There’s:

  • The universal for loop for i in 1..n
  • The terse yet readable times loop n.times
  • Finally the witty upto loop 1.upto(n)

Each loop has different readability and implementation speed. Though I’ve always had a proclivity towards n.times do or 1.upto(n), It was my understanding that it’s generally concluded that the ugly for loop wins. After coming across that statement again and realizing how different RubyMotion was from most other implementations, I decided to give it a go.

The Results

To my delight, the results were clearly. for loop in RM is actually the slowest across the board! From 500, to 5 million, and there’s nearly no difference between n.times and 1.upto(n). If I had to give credence to one or the other, it seems upto wins in Normal rake tasks, and times wins with mode set to release.

I’m just happy all results show not to use the ugly for loop.

Try it for yourself!

CDQ Tip of the Week by Gant Laborde


The motion_print gem continues to sprint beyond its dead competitor awesome_print_motion. Besides being smaller and faster, the gem hast started to support detailed printing of common RubyMotion libraries. The new 0.0.3 release can detect and elaborate on the contents of CDQ objects.

https://github.com/MohawkApps/motion_print/pull/7

Sponsor


My company InfiniteRed sponsors this newsletter by allowing me the time to work on it every week and hosting everything.

Contact us if you ever need help working on a project, mentoring, or other development services . We specialize in RubyMotion and have an awesome team.

image


If you have any tips, blog posts, or comments, please send emails to todd@infinitered.com

Issue #43

rmq.append(UIImageView).on(:force_touch)

Apple Watch, iPhone 6 , 6+, and iOS8: there are many new and exciting things in the iOS world right now. I’m personally excited about WatchKit, as the Apple Watch is a whole new device for us to build apps on, with fun new UI constraints and metaphors.

imageimage

The different point sizes of the iPhone 5, 6, and 6+ are going to add some additional work for us. If you’re using MotionKit’s Auto Layout or RMQ’s grid system you’ll be better off than most.


If you missed the last issue, you can find it here: issue #42.

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


September 12th, 2014 | slides | by Michał Taszycki
Ruby – Write Once, Run Anywhere

September 12th, 2014 | new gem | by Marcus Gartner
Motion-UNIXSocket

September 8th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 41 – Application Workflows in Interface Builder with Storyboards and Segues

September 7th, 2014 | blog post | by Baylor Rae
Using RFQuiltLayout with RubyMotion and RMQ

September 6th, 2014 | new gem | by Qi He
Rubymotion gem to easily use WeChatSDK

RubyMotion Job of the Week


RubyMotion iOS Engineer at Jukely in New York City

Jukely is a matchmaker for concerts and friends. We match live music lovers with concerts and friends to go, with based on their collective music tastes. This gets people go out to more shows.

We are looking for a RubyMotion iOS Engineer to join our team in New York City. The candidate will work on the Jukely iOS app that’s been selected by Apple as Best New App. It’s also been included in Apple’s WWDC sessions for good design and user experience. Read more.

Contact bora@jukely.com

RMQ Tip of the Week


Version 0.7.1 was released yesterday. It adds a grid overlay and some very cool new validation features.

Gant Laborde and Vaughan added some cool new validation features:

white_list

In some situations you may have an outlying exception to the validation rule. Exceptions can be validated as true using the white_list parameter:

rmq.validation.valid?(some_url_input, :url, white_list: ['http://localhost:8080', 'http://localhost:3000'])
# => true for 'http://localhost:3000' even though it's not going to pass URL (missing TLD)

Custom rules

If your validation is specific to a single form, we suggest taking advantage of using the custom validation rule.

some_field = rmq.append(UITextField).validates(:custom, regex: /^test$/)
some_field.data("test")
some_field.valid?
# => true
add_validator

You can add your own validation with the add_validator method (Perhaps in your Application Stylesheet setup). Additionally, you’re not limited to the bounds of a single regex. You can use the ruby methods you know and understand, as well as multiple parameters passed in opts.

rmq.validation.add_validator(:start_with) do |value, opts|
  value.start_with?(opts[:prefix])
end

You can then use your new validator in your application:

some_field = rmq.append(UITextField).validates(:start_with, prefix: 'x')
some_field.data("test")
some_field.valid? # => false
some_field.data("xenophobia")
some_field.valid? # => true

Grid overlay

I added the ability to see the grid for development:

rmq.app.grid.show

or

rmq.stylesheet.grid.show

or

some_grid.show

image

Sponsor


My company InfiniteRed sponsors this newsletter by allowing me the time to work on it every week and hosting everything.

Contact us if you ever need help working on a project, mentoring, or other development services . We specialize in RubyMotion and have an awesome team.

image

Wat!


image


If you have any tips, blog posts, or comments, please send emails to todd@infinitered.com

Issue #42

40% faster

First, as you noticed there was no Dispatch last week. It was a holiday in the US this weekend and I was traveling. I was also waiting for the new update of RubyMotion to be released. So don’t worry, the Dispatch is alive, kicking, and going strong.

Speaking of the update to RubyMotion, it’s a cool one. While you’re focusing on all the iOS 8 stuff don’t miss that last line, the one that says that startup time is 40% faster. That’s huge.

Please let me know if you have measured your apps starting 40% faster.


If you missed the last issue, you can find it here: issue #41.

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


September 1st, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 40 – Interface Builder and the IB Gem

August 29th, 2014 | video | by Jack Watson-Hamblin
Taylor Luk from Issue.by talking about Hybrid Apps at SydInMotion – Sydney RubyMotion Meetup

August 28th, 2014 | examples | by Mark Villacampa
Showcases the use of extension and framework targets in iOS

August 28th, 2014 | blog post | by Matt Brewer
Introducing ProMotion-menu

August 25th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 39 – Publish and Subscribe with NSNotificationCenter

August 22th, 2014 | blog post | by Will Raxworthy
Chromecasting with RubyMotion

August 11th, 2014 | new pod | by Imanol Fernandez
MGSwipeTableCell – An easy to use UITableViewCell subclass that allows to display swippable buttons with a variety of transitions

RubyMotion Job of the Week


RubyMotion iOS Engineer at Jukely in New York City

Jukely is a matchmaker for concerts and friends. We match live music lovers with concerts and friends to go, with based on their collective music tastes. This gets people go out to more shows.

We are looking for a RubyMotion iOS Engineer to join our team in New York City. The candidate will work on the Jukely iOS app that’s been selected by Apple as Best New App. It’s also been included in Apple’s WWDC sessions for good design and user experience. Read more.

RubyMotion App of the Week


image

Songdrop – “Listen to music from YouTube, Soundcloud, Bandcamp and Vimeo all in one place for free! Find songs and add them to your mixes: you can create playlists with videos and songs, then share them with your friends.”

Gems used:

  • bubble-wrap
  • sugarcube
  • motion-cocoapods
  • motion-testflight
  • motion-layout
  • songdrop

Pods used:

  • MBProgressHUD
  • ZKRevealingTableViewCell
  • Facebook-iOS-SDK
  • OHAttributedLabel
  • NewRelicAgent
  • TestFlightSDK

RubyMotion News


RubyMotion 2.32 update

  • The iOS 8.0 and OS X 10.10 versions of the runtime have been recompiled
    with Xcode 6 Beta 6.
  • [iOS] Depracted rake options device_family' andretina’ in favor of
    device_name' which takes the name of one of the configured device-sets
    found in Xcode -> Window -> Devices or the
    simctl’ tool (its location can
    be found in the message shown when using one of the deprecated options).
  • [iOS] Added support for iOS 8 App Extensions. See the motion create --help'
    output for a list of available templates and configure your host application
    with the following:
    app.target(“path/to/extension”, :extension)’.
  • [iOS] Added support for frameworks that allow you to share code between your
    host application and its extensions. Use the ios-framework' template formotion create’ and configure your host application with the following:
    `app.target(“path/to/framework”, :framework)’.
  • [iOS] Fixed a bug where backtraces could not be symbolicated on the iOS 8
    Simulator.
  • [iOS] Fixed a bug where the iOS 8 Simulator could not be launched with the
    default device config.
  • [iOS] Fixed a bug where the iOS 8 Simulator could not be used to select
    views in the REPL.
  • [iOS] Fixed a bug where the REPL view selection would incorrectly invert the
    coordinates for the landscape orientation on iOS 8.
  • [iOS] Fixed a bug where “xcodebuild: error:” message would be displayed
    when it will configure `app.xcode_dir’ for Xcode6 path.
  • [iOS] Fixed a bug where Instruments.app does not launch with `rake profile’
    on iOS 8.
  • [iOS] Fixed a bug where iPhone 4s / iOS 7' simulator was always launched
    if Xcode 6 location path was specified through
    app.xcode_dir’.
  • [iOS] Fixed a bug in iOS 8 where Hash objects could not be passed as an
    object of an NSUserDefaults.
  • [iOS] Added `app.embedded_frameworks’ configuration to support dynamic
    framework on iOS 8.
  • Fixed a bug where headers in nested symlinked directories could not be used
    with `vendor_project’ and an Xcode project.
  • Fixed a regression where a crash would happen when calling user defined
    method if the same method was already defined in some classes in Apple SDK.
  • Fixed a regression where a crash would happen when calling methods after
    used a method with variadic arguments.
  • Fixed a bug where a “not precompiled” error would happen when calling the
    SKPhysicsWorld method which takes with Objective-C Blocks.
  • Fixed a bug which superclass method would be called if method was removed
    through Module#remove_method.
  • Fixed a bug which it would trigger crash when the method for KVO was called.
  • Fixed a bug where overrode Time#+ would not be called.
  • Fixed a bug which it would trigger random crash when #method_missing will be
    called.
  • Fixed a bug where it would cause a “Permission denied” error if vendor
    library directory was not writable.
  • Improved Module#define_method performance. ~3 times faster.
  • Improved Object#method_missing performance. ~8 times faster.
  • Reduced the app boot time. ~40% faster.
sudo motion update

Hidden Gem by Gant Laborde


Here’s a classic: Most of you know, you can build an array of default values.

Array.new(5, false)
#=> [false, false, false, false, false]

The second argument populates with references to a single object (WOW Such speed!). But that means if we pass a mutable object, like a hash, we’re not going to get the desired effect.

This can be easily demonstrated with the following: Array.new(5, rand(10)) which lands us something like [2, 2, 2, 2, 2] ewwwwwww.

Just use the proc to the array for mutabel objects. A Hash.new would work fine from our proc. Using our previous example, you can see results are probably more to your liking:

Array.new(5) { rand(10) }
#=> [1, 9, 4, 3, 9]

RMQ Tip of the Week


Tables and collections

People ask me a lot about how to do a UITableViewController or UICollectionViewController in RMQ. The simplest answer is to have RMQ create one for you and look at what is produced. It generates the current best practice for each.

In your command-line do:

rmq create collection_view_controller foo
rmq create table_view_controller bar

Sponsor


My company InfiniteRed sponsors this newsletter by allowing me the time to work on it every week and hosting everything.

Contact us if you ever need help working on a project, mentoring, or other development services . We specialize in RubyMotion and have an awesome team.

image

One more thing


Don’t miss next Tuesday’s announcement by Apple. I hope there are some new things that we can build apps for: iWatch, larger iPhones, etc.


If you have any tips, blog posts, or comments, please send emails to todd@infinitered.com