Archives: Issues

Issue #47

ARM64 support (64-bit), build your App Extensions now

Until version 2.36, RubyMotion did not support 64-bit. Because of this, you could not write App Extensions that worked on a device. 2.36 fixes this issue. Go forth and extend.

See below in the release notes for more info.


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

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


October 13th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – RubyMotion for Rails Developers: Hello RubyMotion

October 10th, 2014 | blog post | by Christoffer Lernö
The Other Alternatives – While Swift is working towards 1.1, I thought it could be interesting to compile an inventory of languages that position themselves on top of the ObjC runtime.

October 9th, 2014 | blog post | by Jack Watson-Hamblin
Big changes coming to MotionInMotion and RailsInMotion

October 7th, 2014 | new gem | by Eric Henderson
motion-paddle – A RubyMotion gem for the Paddle framework

October 6th, 2014 | podcast | by Access Ninja
Access Ninja episode 004: Austin Seraphin part 1 (Austin is always fun)

October 6th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 46 – From Interface Builder to NSLayoutConstraints

October 5th, 2014 | new gem | by digitalfx
RubyMotion-Leap-Motion – A starting point for using the Leap Motion in RubyMotion

October 3rd, 2014 | blog post | by Tony Hillerson
RubyMotion Releases Android Public Beta

October 2nd, 2014 | video | by RubyKaigi
Laurent Sansonetti – Inside RubyMotion for Android – RubyKaigi 2014

RubyMotion News


RubyMotion 2.36 released

  • Added ARM64 support (64-bit) for iOS. It is not yet enabled by default for
    applications that do not embed Frameworks or App Extensions. In order to
    enable it on other builds add the following line to your project’s Rakefile:
    app.archs['iPhoneOS'] |= ['arm64']
  • iOS 4.3 and OS X 10.7 are no longer supported, due to internal changes
    that require us to use a newer C++ standard library.
  • [iOS] Fixed a bug where the app.provisioning_profile setting would not be
    configurable in the Rakefile of App Extensions projects.
  • Fixed a bug when copying an ImmediateRef, which isn’t needed anyways,
    because a tagged pointer can not be duplicated either.
  • Fixed a bug where Xcode 6 would cache precompiled headers in a
    hidden location and subsequent vendored builds could fail after cleaning.
  • Fixed a bug where a failed vendored build could cause subsequent builds to
    never actually start.
  • Fixed the build system to remove Xcode 6 noise from vendored build output.
  • Fixed a bug where the #supportedInterfaceOrientations method would be not
    properly included.
  • Fixed a race condition bug in the runtime where a crash would occur if
    the same Objective-C constant was being resolved at the same time from
    different threads.
  • Fixed the motion changelog command to honor the --pre flag, which will
    open the pre-release NEWS file instead.
  • Fixed the motion update --pre command to print a reference to the
    motion changelog --pre command.
  • Improved IO#.read performance to read from files. ~4 times faster.

sudo motion update

Hidden Gem by Gant Laborde


“My custom font is not being positioned right!”

This info might save you a ton of time one day. It’s not specific to anything RM, but that’s what makes it so tricky!

Custom fonts are a great thing to add to any iOS app, but sometimes they pack a hidden cost. The font creator may not have tested their font on iOS/OSX. That’s why generally do my best to stick to Native iOS Fonts. If your font is being clipped in the containing label in any direction, you’re not going to be able to set an inset to fix this. You’re going to need to modify the actual font with a font editor like Mensis or Apple Font Tool Suite. Today I’m showing the latter.

Using the command ftxdumperfuser, which is one of the many commands in the suite, we can force an XML generation of the font attributes. The command used on a font named MetaOT-Norm.otf would be: $ ftxdumperfuser -t hhea -A d MetaOT-Norm.otf and will generate a file called MetaOT-Norm.hhea.xml

In the above command -A is for auto-fuse of the XML in and out (-A d/-A f). “-t hhea” is specifying we’re going to modify the horizontal-header table, where we can pad the font properties correctly.

Modify the properties of this XML file. For me the Descending property needed to be toned down from “-347” to “-247”.

You can then merge your changes back into the file with the command:

$ ftxdumperfuser -t hhea -A f MetaOT-Norm.otf

VOILA! The custom font works like a charm now!

RMQ Tips of the Week


I haven’t done an RMQ tip in a while, so I have a few tips for you this week:

rmq by itself

rmq by itself is the same as rmq(rmq.root_view), it’s just a shortcut. So when you do something like this:

rmq.log :tree

You are really logging the root view’s tree. Same thing for rmq.append(UIButton), that is appending a button to the root view.

The one odd thing is when you’re using a utility, which really doesn’t apply to the root view, such as:

rmq.image.resource('foo')

Technically it still has selected the root_view, but you aren’t using it.

Simple animations

Did you know you can animate simply with rmq? Like so:

rmq.animate do
  rmq(UIButton).nudge r: 40
end

A better way to do that is select something first. In this case q is an RMQ instance selecting all UIButtons:

rmq(UIButton).animate do |q|
  q.nudge r: 40
end

You can read more about it here.

From the Archives

(because it’s easier to copy & paste than to write)


iOS Marketing Tip of the Week by Mark Rickert

Did you know that you can contest bad reviews your apps get in the App Store? I’ve done this a few times when a user gave me a 1-star review for the app lacking a feature that existed since version 1.0.0. Apple actually reads these and the reviews were removed from iTunes within a few days.

Here’s a step-by-step guide on how to get the inaccurate review removed:

  1. Log into iTunes Connect.
  2. In the lower right corner, click the Contact Us link.
  3. From the dropdowns, select: App Store Questions, then Customer Reviews, then Specific Removal Request.
  4. A text block will appear with another contact us link. Click that, fill in the requested information, and submit!

Apple sure makes this hard for us developers to find, but at least there’s a way to contest the inaccurate or inappropriate reviews.

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 #46

Yosemite GM, Xcode 6.1 GM, SDK 8.1, and RubyMotion 2.35 all work

I can confirm that all this is working together, and I’m now using it on my production workstation. Your mileage may vary. Earlier this week a lot of us were having problems, but they are all resolved now.

I did this:

  • Upgraded to Yosemite GM from Apple Development center
  • Deleted Xcode 6.01 and emptied the trash
  • Downloaded Xcode 6.1 GM from Apple Development center
  • Installed it
  • Went to the App Store, went to “Updates”, then installed “Command Line Tools (OS X 10.10) Version 6.1”
  • rake clean:all ; bundle ; rake pod:install in all my projects

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

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


October 2nd, 2014 | blog post | by Jack Watson-Hamblin
Is RubyMotion Suitable for Client Work?

September 30th, 2014 | reddit thread
Is Rubymotion Suitable for Client Work?

September 29th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 45 – Size Classes in Xcode 6 Storyboards

September 29th, 2014 | new gem | by Ignacio Piantanida
motion-splash – Create iOS launch images from any UIViewController with RubyMotion

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

RubyMotion News


RubyMotion 2.35 released

  • Fixed a bug that could occur when the only available SDKs are newer than the available BridgeSupport metadata.
  • [iOS] Fixed a bug where it would not symbolicate with rake profile:device. The dSYM file path was changed to fix a bug.
  • [iOS] Fixed a bug where the RubyMotion shared framework would not update even if it changed the code in framework.
  • [OSX] Fixed a bug that would always cause the REPL to crash.
  • Fixed a bug where GLKit functions would trigger a crash when it will run app on iOS simulator.

sudo motion update

RMQ News


RMQ 0.8.0 released

Release notes are here.

It has new landscape, plugin, and iOS 8 features.

RMQ plugins aren’t fully done, but they are mostly done. The first plugin is being built and we’re already using it in an app we’re working on, you can check it out here.

Note: if you get an error about your UITextViewStyler, replace its superclass with UIScrollViewStyler

Hidden Gem by Gant Laborde


You use the internet for docs, stop fooling yourself.

A lot of the Hidden Gems I write about are general Ruby hints or heavily opinionated; today it’s both. I’d like to start with a short anecdote.

One of my favorite life-hacks ever:
“Turn every coat-hanger around in your closet. In a year or 6 months, take every piece of clothing that is still on the reversed hanger and donate it to charity. You’re not using it.”

Today is that coat-hanger moment. Have you EVER? used ri or rdoc? Shy of flights or sea-coders, you can’t even come up with an instance where you need to ri Array RIGHT NOW! Just stop it. I first came up with this as a way to speed up installs on my poor Raspberry Pi, but after watching sinatra install docs, I decided to cut the cord. Join me! Tell your gems not to pull docs anymore, and realize McDonalds has free WiFi, if you ever find yourself needing to look something up on the road.

$ echo 'gem: --no-ri --no-rdoc' >> ~/.gemrc

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 #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

Issue #41

Grid Playground

Chuck Newport and the prolific Gant Laborde have written a super cool tool called the RMQ Grid Playground.

image


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

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


August 22th, 2014 | blog post | by Sunil Kumar
SSL Pinning With Rubymotion

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

August 20th, 2014 | blog post | by Stalin
RubyMotion Query (RMQ) Validations – Allow blank

Note, this is fixed in RMQ edge

August 19th, 2014 | blog post | by Kamil Lelonek
Concurrency patterns in RubyMotion

August 18th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 38 – RMQ Validations

August 17th, 2014 | blog post | by Jamon Holmgren
Creating a Custom UITableViewCell with ProMotion

August 12th, 2014 | example app | by Gant Laborde
JGProgressHUD Pod in RubyMotion

September 17th, 2014 | conference in Japan | by Shizuo Fujita (Watson)
RubyMotion Kaigi 2014

RubyMotion App of the Week


image

BAGtheapp by Nacho Rapallo

From the Archives


Because it’s easier to copy and paste than to write

NS classes

Dates inherit NSDate, strings inherit NSMutableString (which inherits NSString), and arrays inherit NSMutableArray (which inherits NSArray).

This is useful because you get all the normal Ruby string stuff, but you also get the NSMutableString and NSString stuff. There are some cool things in there, check out the docs (and use Dash for your docs)

Here is a cool example, NSArray has the pathsMatchingExtensions method:

(main)> [ '/foo/bar/hello.txt', 'report.pdf', '/user/me/resume.doc' ].pathsMatchingExtensions([ 'txt', 'doc' ])
 => ["/foo/bar/hello.txt", "/user/me/resume.doc"]
(main)>

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!


The dilemma of mobile apps development


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

Issue #40

Just-in-time libraries

When I was a younger fellow, I would dream up perfectly formed libraries. I would marvel at how beautiful they were and how clever I was. Sometimes I would actually use the library in a project, sometimes not.

As I got older I started to build “just-in-time libraries”, which are libraries that you build only when you need them during the actual creation of a real project.

These kind of libraries are not complete, aren’t as beautiful to behold, and often have pragmatic things that aren’t 100% consistent. However they are guaranteed to be used and are naturally optimized to solve the problems that actually exist.

The reason I’m telling you this little story is because RMQ 0.7 was just released with a new feature: validations. It, like the rest of RMQ, was born during frustration while working on an actual project.

Gant Laborde create the validations feature and it’s a cool one. Thank you Gant.

See RMQ news below for more info on validations.


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

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


August 14th, 2014 | new meetup
London RubyMotion meetup

August 11th, 2014 | blog post | by Rob Horrigan
RubyMotion 3.0: Android support

August 11th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 37 – Test Driven Development and Creating a Gem Part 2

August 9th, 2014 | blog post | by Kamil Lelonek
RubyMotion app with Facebook SDK

August 8th, 2014 | blog post | by Lori Olson
Static Tables in Code

August 7th, 2014 | blog post | by Gant Laborde
Dealing with bad data and the Hash structure’s defenses:

RubyMotion App of the Week


image

Hacker Bar by Mark Rickert

GitHub repo

Gems used in the app:

  • bubble-wrap
  • afmotion
  • motion-cocoapods
  • ib
  • menu-motion
  • motion_print

Pods used in the app:

  • Mixpanel-OSX-Community
  • Ono

RMQ News


Validations

Version 0.7 was just released. The major new feature is validations. They were created by Gant Laborde

Read the documentation here

# Examples of the Utility
rmq.validation.valid?('https://www.infinitered.com', :url) #true
rmq.validation.valid?(98.6, :number) #true


# Examples of Selection Rules
rmq.append(UITextField, :user).validates(:email)
rmq.append(UITextField, :password).validates(:strong_password)
rmq.append(UITextField, :pin).validates(:digits).validates(:length, exact_length: 5)

rmq(UITextField).valid? # checks if selected is valid
rmq(:password).clear_validations! #removes validations on selected

Hidden Gem by Gant Laborde


Avoiding begin/rescue for Hashes

In RubyMotion, if you were to run the following application, you can get back with me on how it went in about week or so.

n = 5000
my_hash = {a: 1, b: 2}

n.times do
  begin
    z = my_hash.fetch(:z)
  rescue
    z = 26
  end
end

Your REPL will be filled with n KeyErrors that run slowwwwwwwwww. The way RubyMotion handles exceptions is a nightmare in this particular situation. Today’s hidden gem is that Hash#fetch accepts a block. Instead you can write.

n = 5000
my_hash = {a: 1, b: 2}

n.times do
  z = my_hash.fetch(:z) do
    # do anything here.  Runs if fetch fails
    26
  end
end

This runs all 5000 in under a second. It’s a silly example, but it proves a point. For more information on Hashes, see my latest blog post: Dealing with bad data and the Hash structure’s defenses

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!


In Ruby:

0.1 + 0.2 == 0.3
#=> false

However, RubyMotion is correct:

0.1 + 0.2 == 0.3
=> true


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

Issue #39

Scene Kit is coming to the Dispatch

At InfiniteRed, Will Raxworthy and I have been working on a project using Scene Kit. Scene Kit is like Sprite Kit but it’s for 3D graphics (Sprite Kit is for 2D).

There is very little documentation out there on Scene Kit, so we’ve had to figure it all out. Our pain is your gain, as I will be creating some basic gems in RubyMotion and creating some example apps.

It’s really fun stuff, stay tuned.


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

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


August 5th, 2014 | blog post | by Stalin
Audio Recording – RubyMotion

August 4th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 36 – Test Driven Development and Creating a Gem

August 3rd, 2014 | blog post | by Jamon Holmgren
ProMotion 2.0 Launched

August 2nd, 2014 | blog post | by Jack Watson-Hamblin
Gaining Control of RubyMotion with UIViewControllers

August 2nd, 2014 | guide | by Jamon Holmgren
Migration Guide: ProMotion 1.2 to 2.0

August 1st, 2014 | blog post | by Jack Watson-Hamblin
Starting a RubyMotion Application

RubyMotion App of the Week


image

Groceries by Ketan Anjaria

Gems used in the app:

  • afmotion
  • bubble-wrap
  • sugarcube
  • motion-testflight
  • motion-support

Pods used in the app:

  • AFNetworking
  • ViewDeck
  • Analytics/Segmentio
  • Analytics/Crittercism
  • Analytics/Mixpanel
  • Analytics/Flurry
  • Reachability
  • BSKeyboardControls
  • SVProgressHUD
  • MSLabel
  • TSMessages
  • UIDeviceIdentifier

ProMotion Tip by Mark Rickert


ProMotion is all shiny and new! There aren’t a lot of added features in 2.0.0 but you’ll find it builds 55% faster and is 20%+ lighter!

One new feature I was able to sneak past Jamon is the new ‘longpressable’ TableScreen module. You’ve always been able to fire an action for a particular table cell whenever it was tapped, but I needed a way to tap and hold to fire a different action based on that gesture. This 25-line module does just that.

Simply add longpressable to the top of your PM::TableScreen subclass (where you’d put searchable or indexable) and in your cell hashes add long_press_action: :some_action.

Internally, it adds a UILongPressGestureRecognizer to the table view and when the action is triggered, it figures out what cell your finger is on and runs the long_press_action associated with the cell!

Make sure to check out the migration guide since some other things have changed in the way TableScreen cells are passing data back and forth.

Bonus tip: longpressable defaults to 1 second, but you can modify that like this:

longpressable min_duration: 2.5

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!


To error is human, to force you to care about the error is Java


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

Issue #38

Did you know that constant lookups are slow in Ruby?

Laurent and I were having a conversation one day about things in Ruby (and RubyMotion) that were slower than one might expect. The big one that popped out at me was that Constant lookups are slow.

That was crazy to me, as I assume that FOO = 'Bar' is the fasted way. It turns out that Ruby’s rules for constant lookup are so complicated that only the MRI implements all of them. Because of this, the process is slow.

The fastest thing you can use to store ‘Bar’ is to use @foo = 'Bar'.

It’s all relative of course and “slow” in this case is still very fast compared to most of our application code. However, if you are in a tight loop and you need the highest performance possible it’s good to know about. Also, Laurent said he caches the constants in the RM runtime to help with this problem.

Method invocation (calling a method) is also one of the slower low level things to do. So for maximum performance, you can inline them into one method.

image


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

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


July 28th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – Episode 35 – Tab Bar Controllers And How To Customise Them

July 24th, 2014 | training | by Colin T.A. Gray
http://training.rubymotion.com/

July 22th, 2014 | book | by Clay Allsopp
Updated to iOS7 and RM 2.0 – RubyMotion iOS Development with Ruby

July 16th, 2014 | video | by Gant Laborde
Motion Meetup – July 2014 with Colin T.A. Gray

Hidden Gem by Gant Laborde


My text fields aren’t selectable!? Tapping them doesn’t make them becomeFirstResponder!? What am I doing wrong!?

When adding a group of interactive fields to a view, people like to add them grouped, by superview. Often times, in RMQ you’ll see something similar to this:

rmq.append(UIView, :form).tap do |form|
  form.append(UITextField, :some_input1).get.becomeFirstResponder
  form.append(UITextField, :some_input2)
  form.append(UITextField, :some_input3)
  form.append(UITextField, :some_input4)
end

The same can be done by a bunch of addSubview(input) calls, for non-rmq.

QUESTION: Why would it be that you can’t select a text field with a tap?

  • Enable User Interaction? Nope, each subview has their own event queue.
  • Animating? Nope. Though user interaction is disabled on animation (unless UIViewAnimationOptionAllowUserInteraction is set), and that code isn’t animating.

ANSWER:

You can lay everything out, but it’s very important that you make sure the superview (:form in this case) is the right size. If not, then your text fields will be visible but not selectable. In these situations, it’s best to set a holder UIView with clipsToBounds = true to avoid a form growing beyond it’s size, or simply being misaligned down the road.

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


This is useful for Objective-C documentation and sample code. It’s not 100% perfect, but I use this a lot to get started.

Objective-C to RubyMotion Converter


If you have any tips, blog posts, or want to sponsor this newsletter, please send emails to todd@infinitered.com