Monthly Archives: October 2014

Issue #48

People like the new by-week/alert format of the Dispatch

After I sent out the first alert last week, some people contacted me and they liked the idea. So I’ll go ahead and use the new system.

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

Happy coding, Todd Werth (@twerth)

Articles, News, New Gems, and Blog Posts


October 31st, 2014 | slide deck | by Michał Taszycki
Ruby – Write Once, Run Anywhere – Polyconf 2014

October 30th, 2014 | blog post | by Mark Rickert
Prepending the Default RubyMotion Build Task [UPDATED]

October 29th, 2014 | blog post | by Philipp Fehre
Using Couchbase Lite from RubyMotion

October 26th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – RubyMotion for Rails Developers: View Controllers in depth (Part 1)

October 26th, 2014 | video | by Nikolay Nemshilov
Native iOS Development with RubyMotion and UnderOS

October 20th, 2014 | blog post | by Brian Pattison
Ruby All the iOS 8 Push Notifications!

October 20th, 2014 | screencast | by Jack Watson-Hamblin
MotionInMotion – RubyMotion for Rails Developers: Views and View Controllers

October 15th, 2014 | blog post | by bwarner
App to Distribution to iTunes

RubyMotion News


New 3.0 prerelease (Android)

A new 3.0 prerelease (Android) is out: some compiler and build improvements, more Ruby methods and bug fixes. Enjoy and please keep testing!

sudo motion update --pre

RubyMotion Tip


UIAppearance protocol

The SDK has a concept called the UIAppearance protocol. It’s basically a global place to set various styles.

There are some problems with it:

  • You can only set some attributes on some views and controllers
  • The styles only get applied when a view is created, so you can’t use it for theming, where you need to change the theme while screens are already loaded

You still should use it, because if you can set something’s appearance it saves you from styling it throughout the app.

I usually create an StandardAppearance class like so:

class StandardAppearance
  def self.apply(window)
    Dispatch.once do

      UIWindow.appearance.tap do |o|
        o.tintColor = UIColor.redColor
        # set other attributes here
      end

    end
  end
end

Then I call it in AppDelegate:

StandardAppearance.apply @window

Or if I’m using RMQ (which of course I am), I call it in ApplicationStylesheet so that I can use my named colors, named fonts, etc:

class ApplicationStylesheet < RubyMotionQuery::Stylesheet

  def application_setup
    color.add_named :apricot, '#EEAA22'

    StandardAppearance.apply rmq.app.window
  end

end

The following have attributes you can set with appearance:

  • UIActivityIndicatorView
  • UIBarButtonItem
  • UIBarItem
  • UINavigationBar
  • UIPopoverController
  • UIProgressView
  • UISearchBar
  • UISegmentedControl
  • UISlider
  • UISwitch
  • UITabBar
  • UITabBarItem
  • UIToolbar
  • UIView
  • UIViewController
  • UIWindow

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

TOL

Thinking out loud


I personally have 4 rules for company culture: hire creative people, hire nice people, be honest with them as much as humanly possible, and then let them create the culture. Nothing else is needed.

I liked her talk on company cultures: Rocky Mountain Ruby 2014 – Your Company is “Awesome” (But is “Company Culture” a lie?)


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

Alert #1

Biweekly newsletter and new alerts

I’ve listened to people’s ideas and I want to improve the Dispatch, so I’ve decided to change the schedule. I will send out the newsletter every other week (ish) and I’m also going to send out small alerts (like this one) when needed.

The two-week schedule is because some weeks I can’t find enough great content to include, so I’m forced to have less than great content. I prefer to publish less often and have better content.

There is a second problem: when timely announcements need to be made, such as announcing an RM update, I have to wait until the next issue is published. That’s what these alerts are for.

Today we have two alerts, let me know what you think about the new system.

Happy coding, Todd Werth (@twerth)

RubyMotion News


RubyMotion 2.37 released

  • Fixed a regression where Dispatch.once did not work correctly when it was invoked in some points.
  • Fixed a bug where the compiler would crash with an assertion message [BUG] Object: SubtypeUntil ... when compiling certain Ruby files.
  • Fixed a bug in the compiler when compiling for ARM64 where certain types would still be emitted with a 32-bit architecture in mind.
  • Fixed a bug in the compiler when compiling for ARM64 where certain structs would not be properly available (such as NSDecimal).

sudo motion update

Try 64-bit and submit bug reports to HipByte


HipByte wants me to ask you to please try 64-bit mode, and then submit any bugs you find.

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']

Apple will be requiring 64-bit in all our apps:

https://developer.apple.com/news/?id=10202014a

“Starting February 1, 2015, new iOS apps uploaded to the App Store must include 64-bit support and be built with the iOS 8 SDK, included in Xcode 6 or later. To enable 64-bit in your project, we recommend using the default Xcode build setting of “Standard architectures” to build a single binary with both 32-bit and 64-bit code.”

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