UITableView Extension to Deselect Selected Row

Nothing fancy. Just a tiny little extension method that makes doing this in Swift slightly nicer.

Optional Punctuation in Swift

All of the punctuation in Swift looked pretty weird to me until recently, but now that I get it, I’ve really learned to appreciate how great the syntax actually is. The way I think of it is this: if you’re using ?, you’re asking a question, and when you use ! you’re asserting that you already have the answer. Of course, for the second case, you need do need to be sure or your app will blow up.

So, for example:

Asking a Question

if let foo = dictionary["foo"] as? String { ... }

Is the value for the key “foo” a string? If so, assign it to the constant foo.

delegate?.objectDidSomething(self)

Do I have a delegate, and can it respond to objectDidSomething:?

Making an Assertion

managedObjectContext!.save(&error)

I know that managedObjectContext is not nil.

let foo = bar as! String

I know bar is a string, so nothing will go wrong casting it.

My Everything Through the Xbox One Setup

I haven’t posted in a while due to a bunch of reasons, and I’d like to get into a rhythm again. I thought I’d start by sharing the kind of unique way I have my media stuff running through and Xbox One.

I’ve played a bunch of games on the Xbox since I got it in November — and a bunch of them have been great. But the Kinect and HDMI in are the unique part I wanted to mention. My set up is that I have a Kinivio HDMI switcher with a TiVo, Apple TV, and Wii U going into it, and the switchers output plugged into the Xbox. The Xbox can control be setup to control TV functions, and with the Kinect it can do those with voice commands (“volume up/down”, “mute”, “pause”, etc). Since I have everything running through my Xbox, I can keep using those commands with any of my other devices.

Having a bunch of things running through this specific HDMI switcher works especially well because it automatically switcher to any input that start getting a new signal, so I rarely have to manually switch inputs.

The only downside is that I have to have my Xbox One on to use anything else, but in practice that hasn’t been annoying at all.

Brent Is Going to Omni

Brent Simmons is not only a friend, but one of my favorite Cocoa developers. His blog is the most indispensable about writing software I read. Omni is one of my favorite Cocoa development companies. Can’t wait to see what they do together.

The Jefferies Project

The Jefferies Project

What if… in a few years from now, we figure out a way to make deep space travel possible. What if… the first interstellar spacecraft to be built is commissioned by the US Navy and its design is inspired by a science-fiction TV show from the sixties… what would it look like?

Neat! I don’t know why there’s so much emphasis on guns though. Who is it supposed to be shooting at?

Falling Back in Love With Video Games

About three weeks ago — on a whim — I went and bought a new Nintendo Wii U. The Wii U hasn’t sold great, but Nintendo games are what I grew up on, so it seemed like a good way jump back in. I hadn’t really played a lot of video games since I was a kid, but Mario Kart 8 looked awesome, and maybe I could get some of my work friends to come play it with me. I also bought a copy of the latest 2D Mario and a Zelda game too.

Turns out it’s great. Not only have my friends come over a few times for some Mario Kart, but I think I sort of forgot how fun video games can be. I liked it so much I also went and bought a 3DS XL, which is also fun (my favorite game for it so far is The Legend of Zelda: A Link Between Worlds).

If you haven’t played any games in a while, maybe give it a shot. I was pretty sure I was “not a gamer,” but I was totally wrong. It’s a blast, you can do it with friends, and it’s a nice way to get away from programming or whatever you’re doing without fully turning off your brain and receding into a vegetative state.

Automatically Move Downloaded Applications

The first thing I always want to do when a new application is move to ~/Applications. In the past I used Hazel to automate this, but it works just as well with an Automator folder action.

Here’s the actions I set up to do this in Automator:

  1. New folder action.
  2. Receives files and folders from “Downloads”.
  3. Filter finder items > Kind is “Application”.
  4. Move finder items to “Applications”.
  5. Reveal in Finder.

And here’s a screenshot:

move_apps_from_downloads

Swift Optionals

I understood the concept of optionals right away, but since the debugger doesn’t work with Swift in the third beta of Xcode 6, I’m given no clue what I’m actually doing wrong when my app explodes. This article did a pretty good job clearing things up for me.

Matt Bridges:

Objects that may or may not be nil (and the nil-checking code that accompanies them) are the cause of many common programming errors. Swift’s optionals offer compile-time cues to developers about when it’s necessary to nil-check and when it’s not, and makes it harder to write code that misbehaves in the presence of nil.