Xcode UI Testing Tip

February 03, 2016

You’re using Xcode’s UI Testing framework, right? It’s a fantastic way to prevent bugs and know when refactoring you’re not breaking some dark corner of your app. It’s not always easy though! UI testing is still an early technology in Xcode 7. There are bugs, and asynchronous network calls can lead to frustrating false positives.

Here’s an incredibly easy tip to improve your tests: run them on a device with Network Link Conditioner set to “Very Bad Network.”

Things will time out. Your tests will fail. But that’s okay. You’ll quickly see places where it’s the test that’s at fault, and something timed out before a network operation completed. Some of these you can fix that with this snippet:

func waitUntilVisible(element: XCUIElement, file: String = __FILE__, line: UInt = __LINE__) {
    expectationForPredicate(NSPredicate(format: "exists == 1"), evaluatedWithObject: element, handler: nil)
    waitForExpectationsWithTimeout(30) { (error) in
        guard error != nil else { return }
        let message = "Failed to find \(element) after 30 seconds."
        self.recordFailureWithDescription(message, inFile: file, atLine: line, expected: true)

What’s more interesting are the places where it’s not the test. I’ll bet you find some interesting race conditions you wouldn’t normally see, even when using Network Link Conditioner during your own debugging. Enjoy this, it’s not always this easy to find these types of bugs!

iOS 9 Storyboard References

December 16, 2015

With every new release of iOS there are the features everyone talks about, and those that get mentioned at WWDC and promptly forgotten about. It’s the latter that often the most useful in the long run, though.

With iOS 9 one of those features are storyboard references. In short, you can split a storyboard into multiple files while still taking advantage of segues and having a visual reference of how your view controllers are connected. And Xcode makes the refactoring process easy. It’s a five minute deal, even if you’re starting with a big messy storyboard.

No more scrolling through a huge storyboard trying to find the view controller you need. Merge conflicts? Still a pain, but they should happen a lot less.


April 15, 2015

My latest project I’d like to introduce you to is Etiquette.io. With the upcoming release of the Apple Watch, we’re going to be encountering all sorts of new, awkward social encounters. Etiquette.io is my attempt to fight rudeness in future technology.

I owe many thanks to the talented Christopher Reineman for the illustrations!

Marcus Zarra’s Core Data Stack

April 08, 2015

There’s an unfortunate but understandable tendency to avoid Core Data in the iOS developer community. Follow the correct patterns though, and Core Data can help you build a reliable, performant data model. And there’s no better person to talk about Core Data than Marcus Zarra. Take a look at his latest article here.

Travel Hacks

March 09, 2015

I’ve been traveling a lot the past year. Like anyone who flies frequently, I’ve come up up with my own list of gadgets and strategies to make getting places easy and efficient. Maybe they’ll help you on your next trip?

  • TSA Pre is absolutely worth it. Get it now, just to make sure you have your known traveler number in time for your next flight.
  • Earplugs. Always pack earplugs.
  • Vitamins, pain killers, and sleep aids (melatonin) are all useful, but you usually don’t need to bring an entire bottle with you. Buy a couple contact lens cases from the pharmacy. They’re perfect for carrying a small amount of pills.
  • Sign up for the rewards program whenever you stay at a hotel, fly or rent a car. Even if you don’t plan on earning an upgrade, just being a member can get you better treatment from staff.
  • Bike clothes often make the best travel clothes. I don’t mean tight, athletic gear– I’m talking about “city” biking apparel from companies like Chrome or Levi’s commuter line. These items are tough, are vented to breathe well, and have extra pockets for carrying small items. Some are made from materials like wool, which won’t start to smell even after having been worn several days in a row.
  • On some flights, if you board near the end you may have to check your carry-on when the overhead bins fill up. Make sure anything valuable or fragile can go in a smaller bag under your seat.
  • Check in as early as possible online. You might be able to snag a better seat, and if for some reason the airline didn’t add your TSA known traveler number you can call them to resolve it.
  • A small battery pack can be extremely helpful. I carry a small one with a built-in cable, and sometimes put a high capacity one in my bag as well.
  • Speaking of power, a travel surge protector (especially one with USB outlets) can be very useful. It’s not an item that’s strictly necessary, but one you’ll appreciate when you have several devices to charge and only one easily accessible power outlet.
  • Coffee drinkers should pack a few caffeine pills. There may come a time when it’s not possible to find coffee, even bad coffee. And while there’s something to be said for taking a break from caffeine, it’s not fun to show up for an event feeling like you’re still asleep.

Ten Years

November 15, 2014

My first success in software came in college, soon after I started writing Mac OS X apps. I was new to Objective-C, and building my knowledge by making small system utilities and accessories. One of these tools, Widget Manager, ended up becoming popular. This was back when 10.4 was new and Dashboard Widgets were one of the big features. In the first release of 10.4 you could easily add new Widgets, but not remove them without going into your Library folder and deleting the file. It wasn’t user friendly. For a time this was a big opportunity, which my app happened to fill.

Widget Manager had tons of downloads, it was reviewed and mentioned in the press, and because I put a “donate” button on my website I actually earned nearly $1,000 just from donations. It was cool.

Since then I’ve shipped a few paid apps under the name Downtown Software House, and built several that never made it out the door. I’ve become a full time iOS developer building apps for client agencies, San Francisco startups, and enterprise developer shops. I still consider myself an indie developer at heart, though it’s been a few years since I’ve built anything on my own.

I’m not ready to call it done. Downtown Software House recently turned ten years old, and with the anniversary I have a new plan in mind. I’m switching my focus to small, useful, niche apps. Apps that don’t require a lot of engineering time, but still fulfill a specific need. Initially these will be 1 to 3 month efforts. They won’t share the same code, but I will reduce the amount of work required by building similar workflows, UI, and using the same technology for features like sync. I’ve failed before by spending too much time on features that ultimately didn’t matter. And while attention to detail is important, I believe I’ll have more luck shipping 3 nice things than working continuously on one single product.

There’s some risk to this plan. There’s overhead and maintenance each time you ship an app. I’ve seen other successful small companies go in the opposite direction, and discontinue their smaller apps in favor of large “moneymaker” products. But, like with Widget Manager, money isn’t my only goal. And if things go well, the work I’m doing now may turn into a foundation for bigger things.

The first step is already done. Earlier this week I shipped Didn’t Buy, an iPhone app to help you save money and curb impulse spending. An update with some new iOS 8 specific features is already underway, and I’ve already begun building a second, unrelated app using some of the same ideas that went into Didn’t Buy.

Making money on software is hard. The effects of the iOS and Mac App Stores have been a big topic of conversation among indie software developers for years. But the truth is it’s always been hard. I don’t plan on turning my own apps into a full time business, or expect huge sales. But money isn’t the only measure of success. I’ll be able to build my skills on technologies I don’t often work with at my day job. And there’s the pride that comes out of building something useful and sharing it with the world, as I did with Widget Manager.

Will my plan work? Just like the past ten years, it’s all still an experiment.

Doxie Go Scanner

September 21, 2014

One of my favorite gadget purchases in the last couple years has been buying a Doxie Go document scanner. It’s small, portable and battery powered. You turn it on, scan whatever you need to, and connect it in to the computer at a later date to save it permanently.

Doxie Go

Coming from someone who used to not own a scanner, it’s brilliant. I’m the type of person who used to let papers pile up forever, or just toss them unsorted into a box to sit for years. It’s a relief not having to deal with that anymore. Mail comes in, gets scanned, and goes directly into the shredder. I don’t have big document boxes taking space in my closet to deal with when I move.

The Doxie is awesome because of it’s portability. I gave up on a large home office a long time ago, and a flatbed scanner or all in one printer isn’t feasible in my space. The Doxie can sit in a drawer until it’s needed, and then scan stuff on my desk or the kitchen table. It’s possible to automate the process by using a wifi capable SD card, though I haven’t felt any need for that yet.

This sounds a bit like a paid review (it isn’t), but I really do like this thing. Recommended.

Daniel Pasco talks about QA

July 26, 2014

Recently @dlpasco has been writing a series of excellent posts on the Black Pixel blog about how quality assurance works at his company:

Quality assurance is one of our most powerful secret weapons, and I’m not worried about being copied, because - as with other development concepts - simply going through the motions isn’t enough to make a difference. Besides, really good secrets continue to be useful even after being publicly disclosed.

I’ve never been on a team with a dedicated QA person, but I’ve still enjoyed Daniel’s insight. It’s good know just what works, since it’s very likely I’ll need that information one day.

More important though, there are tons of reminders about all the edge cases I ignore as a developer. I like to think I’m pretty good at testing, but looking at a chart like this I’m reminded about all the potential problems I rarely consider or knowingly ignore. That doesn’t mean I can’t do better in the future, though.

CocoaLove Conference

July 26, 2014

There’s a new conference coming this fall I’m excited about. It’s called CocoaLove, October 24th-26th in Philadelphia. Like any good event, it has a great lineup of speakers I’m looking forward to meeting. But the focus at CocoaLove isn’t technical topics, it’s people and community.

Technical conferences are fun. It’s great to get inspired, and perhaps learn a thing or two. But a big reason I’ve focused on Cocoa programming for over ten years has been the excellent community behind it. At the same time, community is one of the biggest challenges facing tech today. I’m glad to see a conference where people are the focus, and I’m looking forward to seeing you there.

Luis Abreu Talks About iOS 8 and Privacy

July 07, 2014

I’ve gathered this information by watching over 17 hours of WWDC 2014 sessions and carefully reviewing, analyzing what was said, and writing a huge number of notes on Security, Privacy, UX and other areas which I will be publishing here in the coming weeks.

There’s some great information here. Worth reading, especially if you have an app that accesses resources such as Core Location or the camera.

WWDC ’14

June 03, 2014

Wow. I’ve been a Cocoa developer for about 11 years, and I’m not sure I’ve ever been as excited about what’s being announced at WWDC as I am this year.

I’ll admit to being a little jaded to the platform at times. There’s the whole “race to the bottom” in app store prices. All of iCloud’s continuing problems. The (perceived) lack of innovation as Android has caught up and surpassed iOS in some areas.

My one thought after yesterday’s keynote is that Apple is still getting it right. There’s no iWatch, no TV SDK, but what was announced just opened up the doors for the next several years. It’s not going to happen overnight, but the Apple platform is going to get awesome. More powerful, more usable, and more innovative. And Apple knows it too. The atmosphere onstage at the keynote was still of a company at its best. As Craig Hockenberry writes, Apple has found a new confidence in itself.

The future looks bright. I’m very happy to be a Cocoa developer right now.

The Ghost Blogging Platform

May 25, 2014

Today I’m switching my blog from Wordpress to Ghost. Which means I should apologize for broken links, duplicate items in your RSS reader, etc. You know the drill.

I don’t have any real reason for moving, other than I’m switching hosting providers and there’s no better time to re-evaluate my options. And Ghost seems nice. It’s young, modern, and a little rough around the edges. The available themes seem to be built around content and typography rather than widgets and fluff. Writing posts in Markdown is nice, I enjoy it more than Wordpress’s visual editor or writing in HTML. Maybe the best part though, is that I’m starting to learn about tools like nginx, Ember.js and Sass that I’ve been meaning to pick up.

As a side note, it’s been fun looking through my old posts for content that needed special attention to migrate. It’s almost hard to remember back when the iPhone SDK didn’t exist, only a few early adopters were using git, and the CocoaDev Wiki was the place for Apple developers. You don’t really think much about just how much things have changed since then.