Archive for February, 2015

Swift: 1.2 has dropped

Just a few points. I haven’t been able to spend any time testing yet:

  • There’s a migration tool to enable you to port your code from older versions of Swift to 1.2. HOWEVER, the release notes point out that “Convert to Swift 1.2” may generate build errors when run so coder beware.
  • Swift now supports building targets incrementally. HELLS yes. It no longer should re-build every single file every single time you add a new punctuation mark somewhere.
  • Set now joins the built-in array and dictionary.
  • I am all \o/ over this next one: “if let” now lets you do multiple steps and avoid the PYRAMID OF DOOOOOOOM!
  if let a = foo(), b = bar() where a < b, let c = baz() {
      ...blah blah ...} 
  • Let constants won’t require you to immediately initialize them, so you “set once, use mostly” (SEUM?) pattern with lets. This presumably continues to allow compiler optimization because once set you won’t be mutating the value (although if its a container, you can of course continue to mutate the contents it points to)
  • You can now have static properties and methods in classes, with lazy initialization, global storage. The release notes point out this is an alias for “class final”.
  • There’s some improved closure type inferencing. I mostly tl;dr’ed this. I’ll get back to it when I have a moment.
  • Swift enums can now export to ObjectiveC. I know this has been a bugaboo for a lot of frustrated people. They’ll import as NS_ENUM stuff.
  • I’ll just quote this next one in full: “Objective-C language extensions are now available to indicate the nullability of pointers and blocks in Objective-C APIs, allowing your Objective-C APIs to be imported without ImplicitlyUnwrappedOptional.”
  • Even better, Swift can now import (well, partially import) C unions, bitfields, and other features not natively supported in Swift. David G. is going “eep eep” with happiness right now. C-structs will be zero’ed on your behalf.
  • .self stuff is now automagically demangled. Thank you, Apple.
  • There’s a new @noescape attribute, which with its kafka-esque name, has to do with function closure parameters. Basically, the closure will be deallocated (if I’m reading this right, am I reading this right?) when the function ends, so you’ll only want to use synchronous stuff. It also takes care of self. issues.
  • There are some language tweaks, the ones that affect me most are the change in @autoclosure and argument labels for curried functions.

Development: Between docs and headers

I’m trying to figure out a strategy for that hazy place when docs don’t yet show a property/feature but headers do.

Take the latest versions of NSLayoutConstraint.h. It’s got quite a lot of NS_ENUM_AVAILABLE_IOS(8_0) features that do not appear in the docs. The property is documented in the latest pre-release docs, but it appeared in the headers with iOS 8 gold (and, obviously, during the iOS 8 beta period).

So how do you trust docs vs headers? Is the header a contract or are the docs a contract?

Development: Don’t hate on the new iTunes Connect work flow

Was chatting with some friends in IRC and the topic of iTunes Connect’s new work flow came up. Said one, “I used to get my app description ready, then upload a binary. Now I upload the  binary then wait for iTC to realize it is there. Then wait some more. Then, maybe it is there”.

If this describes your typical iTunes Connect experience, I’d like to courteously suggest that perhaps you’re doing it wrong — not because there’s something wrong with you but rather that the new iTC work flow is far easier once you get the hang of things.

Here’s the thing about iTC these days. You don’t do paperwork first. You do paperwork last. When you’re focused on development, you’re focused on development.  Whenever you think you have a candidate for submission, go ahead and upload it. It will be waiting for you when you’re ready to deal with submission details.

The first critical thing you need to be aware of is builds. Each submission to App Store requires a unique build number, just like each new update requires a unique version number. If you decide to re-submit for whatever reason (no judging — we’ve all been there), just bump the build as needed.

Screen Shot 2015-02-05 at 11.43.46 AMIn the case of folderol, I was getting some great feedback from a user (hi Kent!) so each time I thought I was done and ready to submit, I decided to incorporate more feedback. No worries, it’s easy enough to upload versions at any time. You don’t have to “prepare for upload” or any extra work. Apple collects your builds for you. Yes, there is processing time, but you can hop into iTunes Connect and visit your app’s Prerelease build list. You’ll see a list of all the available and processing builds. If you beat the app to the processed list, at least you know why you’re not seeing yet in your list of available builds in the Versions tab.

Screen Shot 2015-02-05 at 11.49.23 AM

Every time you visit an already-submitted app, you’ll find a self-reject option, which is now called “remove this version from review”. If your app is in review and you do not see this, force-reload the page. I’m pretty sure that’s Option-Reload in Safari, but if I’m wrong hopefully someone will correct me soon.

Screen Shot 2015-02-05 at 11.51.27 AM

After you self-reject, you can remove the current build from the Versions > Build section. Hover your mouse over the build and click the red remove button. Then select another build. Only those builds that have finished processing will appear.

For those of a slightly paranoid bent, be aware that you can never remove builds from iTC. Once they’re submitted, they’re submitted. I’m not entirely sure why this is a sticking point for some people. I operate under the assumption that any build that was submitted was generally meant for public consumption and that any build you self-reject will not be published by Apple. Feel free to enlighten me.

So there you have it, the new iTunes Connect build procedure. Yes, there’s a built-in processing wait, but I have found this new work flow far more rewarding than problematic. Your mileage obviously can and will vary. What do you think? Love it? Hate it? Couldn’t be fussed? Let me know.

Development: Old Macs

No matter how many old OS X installers you end up keeping on your backup data drives, trying to create legacy systems for development testing can be more of a pain than I expected. Recent versions of OS X do everything they can to prevent downgrades, I did better installing early releases onto fresh partitions and upgrading them.

This explains why I just wasted an entire morning creating and upgrading Lion partitions to enable me to have some fresh 10.7, 10.8, and 10.9 on-hand. Fortunately, I long ago wrote up a how-to for creating a stand-alone USB installer stick for TUAW, back when TUAW still existed. I was thrilled to find that stick exactly as I left it because it was the thing that let me boot one of my Yosemite systems (still running Beta 4, apparently) to a suite of tools that actually allowed me to install these OS’s. Yosemite’s recovery partition was not as accommodating.

I set up a fresh USB drive with many partitions, installed Lion into one of them and then cloned that into the other partitions. From there, it was just a matter of having the right upgrades on-hand. (I had them all except Mavericks, but Mike Ash, bless him, pointed out that I could grab a copy from App Store from my old purchases.)

I know there are lots of other solutions including virtual machines and such, but I like having native systems running on native hardware, using a bootable USB hard drive that can move from machine to machine to machine.

I’m still waiting on my Mavericks upgrade but soon my test systems will be all back in shape, even those I thoughtlessly yozed last Summer.

Folderol FAQ #3: Avoiding color blending

Kent writes:

Just purchased folderol (v 1.9). I’m having a dilemma when adding custom images. Sometimes it blends the custom image into the blue color of the folder which changes the color of the image. Other times it doesn’t. I’d like to say I’ve figured out a pattern but I haven’t.


I don’t have examples to look at so it’s a little hard to diagnose. The active color is always blended to the image unless you choose to remove the active color or choose the do-not-blend option. 

Avoiding Hues: Once you clear the color, you’ll see a checked board background. Now when you add a custom image and drop a folder, the image will not blend with a hue.

Screen Shot 2015-02-01 at 09.09.56

Image 2-1-15 at 9.13 AM

Avoiding Image Blends. There’s also a further option called Don’t blend image to icon. When you enable this, the image will replace the folder instead of blend with it.

Here’s what all these options look like:

Original folder: 

Screen Shot 2015-02-01 at 9.21.28 AM

Blended with image (normal, no tint selected)

Screen Shot 2015-02-01 at 9.24.26 AM

Blended with image (pink/red tint selected)

Screen Shot 2015-02-01 at 9.25.31 AM

Do not blend option enabled (no blend with original folder art or the folder’s blue tint)

Screen Shot 2015-02-01 at 9.27.11 AM