Ben Dodson

Freelance iOS, Apple Watch, and Apple TV Developer

Swift extension to make CALayer borderColor and shadowColor work with Interface Builder

I’ve been using Interface Builder in more projects over the past few months due to the benefits of AutoLayout. This has led to me shifting more standard UI code (i.e. colors, borders, shadows, etc) into Interface Builder via the User Defined Runtime Attributes1. However, this doesn’t work for the CALayer properties shadowColor and borderColor as they expect a CGColor rather than a UIColor.

To fix this in a recent project, I created a very basic CALayer extension (in Swift) that adds UIColor accessors so you can set them via the User Defined Runtime Attributes as so:

You can get the extension on GitHub.

  1. You basically just set layer.cornerRadius as the key path and use an NSNumber within the User Defined Runtime attributes and then Interface Builder will handle the rest - no more filling your code with button.layer.cornerRadius = 8, etc. ↩︎

The Divide #5 - 'Jar Jar Abrams', a Star Wars special!

After a slight delay in recording, Episode 5 of The Divide is now available. As a New Year treat, this show is a 2 hour special all about Star Wars. We discuss the original trilogy, the prequel trilogy, some of our favourite Star Wars video games and comics, and then dive into Episode VII, ‘The Force Awakens’ (there are numerous spoilers but we confined them all to the last half hour or so and there is a big warning before we start). We also discuss one of my favourite oddities in the re-release versions, the addition of CGI rocks to Episode IV:

You can get The Divide from these fine outlets:

Don’t forget to leave a review on iTunes and follow us on Twitter via @PodcastDivide

iOS developers don't work for free

Over the years, I’ve received a lot of emails offering me the chance to work on an exciting new project for free in return for some equity. This is an excerpt from one I got yesterday:

We are currently developing a [redacted] site with some developers who are dragging their heels and would like to to jump ship. They are more web developers and not used to app coding. They have been working for free in returning for an equity share in the company.1

We have pitched to a few venture capitalist who like the idea but need to see a minimum viable product out in the market place.

Is this something you would entertain… work for free now but get a percentage of the company?

I write back to (nearly) every email I receive so I used my standard “sorry, I don’t ever work on an equity basis as per my website” reply. However, it’s starting to irritate me just how many of these emails I get per day, the fact they don’t read the clear disclaimer on my contact page, and the mindset that they must have to think that someone is going to work for free for a potential kickback later. Hopefully this post will clear up why I, and most other iPhone developers, will not work for free on your project2.

Short version: We have mouths to feed the same as anyone else.

Long version: There is a huge amount of paid work available to freelance developers and it pays incredibly well3. Some might say that developers are risk averse and so of course they’d choose paid work over the risky equity venture but that isn’t really true — being a freelancer is already incredibly risky with the fact you have to find work and hope that the client does pay on time and as agreed. That said though, choosing equity over money is one step too far on the risk ladder; the chance of it succeeding is very small and you’ll end up working on it for much longer than you anticipated.

For example, lets say you’re a developer charging around £500 a day for your services. To get a project to MVP status, you’re likely going to need to work for 1-2 months so you’re looking at around £10-20k of lost revenue. At this point, you need to make back at least that sizeable amount of money in order to break even. However, as the MVP continues, there will be bugs and new features to be added and you’ll be expected to add them for free; after all, you’ve been doing it for so long by now and if the project needs to switch developers then it’ll most likely die and you’ll end up with nothing. You will keep working for free until the project does eventually fail; you might get some small amount back but the real likelihood is that you’ll end up with nothing but a portfolio piece and the realisation that you should have filled the last 6 months with paid work.

This isn’t hypothetical; whilst I don’t ever work for equity, I’ve worked on a freelance basis on projects who did have other developers working for equity. They were hardly ever available after the project launched (as they needed to work on other projects to put food on the table) and when they were available they did a poor job as they were doing it in their spare time and they’d lost any passion they had for the business. The project folded after 9 months and they got around £1500 for their troubles.

Even if a project does succeed and you do own a portion of the company, it is still going to be a very long time until you see any monetary reward for that. A company only pays it’s shareholders when it is profitable and most startups aggressively use any money they make to grow further; it will likely be years until you get anything. Of course, they might sell to another company and you’ll get a big windfall payment4 but that is highly unlikely.

The biggest issue I have with ‘CEOs’ saying “work for free now but get a percentage of the company” is the hypocrisy of it. They are putting all of the risk of the business on the developers shoulders and bearing very little of it themselves. Most of these people with nothing but an idea are working in a full-time job and continue to do so during the life of the project as they don’t need to do much during development; if it fails, they don’t really lose much whereas a developer loses everything.

My one piece of advice for other freelancers and for people looking to hire them is “if the project owner isn’t willing to use savings or a loan to pay for a developer, then they are showing that they think the project is too risky”. When I built WallaBee, I insisted that all contractors were paid at market rate5 and did so with loans and money from my own freelancing6. If you are trying to get an app built and you don’t do the same, you will not succeed.

This is why I do not work for equity. It isn’t just the fact that I’ll lose money, it’s that I don’t want to work for a business that treats professionals in this way7.

  1. By this point I’ve already dismissed the project out of hand even if they are paying; I don’t work on projects started by other developers and I don’t work for people who treat developers who work for free like crap. I can’t ever imagining being this dismissive of people who have given their time for free and are presumably leaving with nothing. ↩︎

  2. This should really be considered part 1 of a series entitled ‘So you want an iOS developer?’. Later articles in the series will be ‘Why iOS developers won’t sign an NDA’ and ‘Why you should pay your invoice when you receive it, not 60 days later’↩︎

  3. I charge near the higher end as my portfolio and experience allows but even at the lower end you’re still talking £300-350 per day! ↩︎

  4. As we discussed on this weeks episode of The Divide ↩︎

  5. One of my freelancers wanted to have equity and I said no. In my opinion, only founders should have equity tied up in a startup as then they are the ones that succeed or fail; contractors should always be paid. ↩︎

  6. I haven’t made back the money I invested in that business yet but I do have equity in the company that bought it; that is a scenario where equity can be appropriate. ↩︎

  7. I have form in this belief. Many, many years ago, I was offered the chance to work on a project by a guy who was happy boasting about the millions he made from a previous project. We agreed my freelance rate and when we’d start. He changed the start date and I found other work. He then wanted to move the start date back and was very annoyed when he found out I’d taken other work; he then went on to try and negotiate my day rate down. I walked away at that point as I don’t work for boastful millionaires who look to save £20 a day on an already low freelance rate. That company was Hailo and became wildly successful. I don’t ever regret not working for them (though I probably should regret not asking them for equity). ↩︎

Pocket Rocket, read your Pocket articles quickly in Safari on iOS

Ever since I sold WallaBee, I’ve been splitting my time between client work1, my Xbox One, and doing small apps that help improve my life in little ways. Today, Apple finally approved2 my first self-published app in a long time, Pocket Rocket:

I save most articles that I want to read at a later date with Pocket but I hate their mobile apps. Tapping an article will load their own reader view3 and it’s an extra step to jump to Safari. In addition, their apps aren’t updated for split screen support or new device sizes and so the experience is pretty poor. With Pocket Rocket, I wanted to do one thing; have my Pocket queue load up and then when you tap on an article it should load in Safari. I prefer using Safari as then you get to see the article as intended and with content blockers most pages load quickly. I got the basic version working within in an hour and it worked well enough for my needs; then, when I got the iPad Pro, I realised this could be a useful app for other people as it dramatically improves the reading experience especially when used in split screen mode.

Pocket Rocket is completely free with no ads or tracking4. It runs on any device capable of running iOS 9 and is a fully adaptive so it looks great no matter what screen-size you have. Due to this adaptability, it works in all split-screen modes on applicable iPads and that is the way I tend to use it. You can swipe on an article to archive or delete it upon reading. There is also a settings panel so you can choose whether links open in Safari or via an in-app browser (with the option to enable a reader view5 on launch if you want).

You can get Pocket Rocket for free on the App Store.

  1. Of which I’ve done a lot; recently launched apps include Brapp, Chipp’d, and Natural Cycles with two more apps awaiting approval from Apple… ↩︎

  2. I won’t go into details as Apple specifically request people don’t, but it has been one of the longest and most painful App Store review processes to date. I don’t know if they’ve been having a bad month but a number of my projects have had a rough ride through the review process for no good reason lately. ↩︎

  3. I hate their reader view as it often misses text or puts pull quotes in the wrong places. In addition, the scrolling was completely broken on the iPhone 6S for a few weeks. ↩︎

  4. Literally nothing leaves your device apart from when you log in with Pocket (and that is a secure connection with Pocket’s servers via OAuth so I see nothing); I don’t want to know anything about you and respect your privacy. This also isn’t a money-making exercise so the whole thing is free with no In-App Purchases. ↩︎

  5. The reader view is only available in the in-app browser, powered by SFSafariViewController, as there is no URL scheme for opening Safari with reader view enabled. I’ve submitted a Radar (rdar://23684808↩︎

Natural Cycles Apple Watch app

I’m very proud to announce that my first Apple Watch app for a client has gone live in the App Store; Natural Cycles.

Natural Cycles is a popular iPhone and Android app that allows you to track your fertility or plan a pregnancy. It can tell you when you are fertile, when you are ovulating, when your next period is due, when you are pregnant, and the progress of your pregnancy. I was hired as a freelance Swift developer to build an Apple Watch app that would be bundled in with their big v2.0 update and would allow viewing and logging of this critical information. The app allows you to see your current fertility level, body temperature, and progress of your period as well as viewing messages from Natural Cycles. In addition, you can quickly update your current body temperature and menstrual flow within the app:

As well as the core Apple Watch app, I also added support for Notifications and Glances making for an even quicker way to view your information:

My favourite feature, however, is the addition of full text Complications so you can see your current body temperature and fertility status on your watch face:1

The project was quite difficult (but rewarding!) for a few reasons. Firstly, the design was very ambitious when watchOS severely limits the amount of customisation that can be performed. Secondly, the iOS app was a Cordova app2 rather than a native app which meant I had to write a JavaScript plugin and set up some build scripts in order for the native Swift watchOS code to be able to speak with the iPhone. There was also a requirement to make the app as easy as possible to update (i.e. updating the iOS app shouldn’t break the watchOS app) and so I built everything such that the phone takes care of all logic and a lot of the UI so the watch app can be altered without going through the App Store review process.

This was a really exciting project to work on and I’m very happy with the end results. You can download Natural Cycles from the App Store or learn more on their website.

  1. This did lead to an awkward situation when I’d left the complication enabled on my Mickey Mouse face that I use at weekends; the weekend after testing was complete, I switched to my Mickey Mouse face to be greeted with the words “Not Fertile” underneath his tapping foot! ↩︎

  2. I don’t usually work on non-native apps but I was willing to make an exception as the bulk of code I’d write would be fully native (as there is no way to write non-native apps on the Apple Watch due to the lack of a UIWebView) ↩︎

The Divide #4 - Getting into code

Episode 4 of The Divide, a podcast I co-host, has just gone live. This week, we discuss the routes we all took to becoming software developers. We take a look at how the programmer market is evolving while sharing our experiences of how we learned to code and we close with some musings and tips on where new coders might start to learn how to join the digital gold rush. Chris also shares a harrowing tale of how Captain Janeway wouldn’t look at him…

You can get The Divide from these fine outlets:

Don’t forget to leave a review on iTunes and follow us on Twitter via @PodcastDivide

Steve Jobs introduces the iPad at Death Star briefing

I’ve been re-watching Star Wars1 this weekend in preparation for The Force Awakens and a special episode of The Divide we are recording after Christmas. When it got to the Death Star briefing sequence towards the end of A New Hope, I was reminded of an excellent video that came out after the original iPad announcement with a mashup of that sequence and Steve Jobs voiceover. I had a quick look for it and couldn’t find it as for some reason it had been removed from YouTube2. After much searching, I eventually found a copy online but I’ve extracted it and saved it here to avoid it disappearing again in the future:

I absolutely love this video and wish I knew who created it.

  1. In Machete Order, obviously (although I’m tempted to re-watch The Phantom Menace after this theory that Jar-Jar is a Sith master…) ↩︎

  2. It doesn’t look like a takedown notice so maybe the account was deleted for some other video and this disappeared along with it. ↩︎

Using the Siri Remote with the Apple TV Simulator

I’ve been working on a tvOS app for a client recently which has led to a lot of time spent building to both the Apple TV hardware and simulator. Whilst the simulator is very good for basic testing, the simulated remote can be a bit tricky to use and so I was very pleased to discover today that the physical Siri Remote can be used with the Apple TV Simulator on El Capitan. All you have to do is pair your Siri Remote to your Mac and it’ll work in the simulator just like it does with the real thing.

The full set of steps are as follows:

  1. Unpair your remote from your existing Apple TV (if applicable) by holding down the menu button and volume up button for around 5-10 seconds whilst the Apple TV is unplugged or otherwise out of Bluetooth range1.

  2. Open up the Bluetooth settings panel in OS X; you should see a device with no details other than a mac address. Pair it.

  3. Profit! Your Siri Remote is now paired and can be used in the simulator.

I have a 1080p external monitor plugged into my iMac 5k and so if I run the Apple TV simulator on that in fullscreen mode it feels almost exactly like using the real hardware. This could be a good stop gap for those on a budget as you could just buy a Siri Remote for testing rather than the whole Apple TV2. You should always test your apps on real hardware of course but this is a useful trick nonetheless.

  1. Otherwise it’ll just unpair and repair very quickly - a frustrating way to spend 15 minutes on a Wednesday morning! ↩︎

  2. Or for developers who simply don’t want a second Apple TV. I’ve been moving mine between my office and living room for the past week and considered getting a second “development only” Apple TV to avoid this minor irritation; buying just a second remote seems a wiser investment. ↩︎

Introducing 'The Divide'

I’m happy to announce that The Divide, a new podcast I’ve been working on recently, is now available on iTunes.

Every two weeks, myself, Mr Christopher Ford, and Dr John Wordsworth will discuss a particular topic that is of interest to us for around an hour. The topics of our first three shows (which are available now) are:

  • Episode 1, The Phantom Keeper: A round-table discussion of our favourite PC games with each of us allowed to bring two for consideration

  • Three Geeks and a Toddler: A debate about our current computer setup and whether we can see a tablet replacing our laptops

  • Fitting in with all of the stereotypes: We discuss media in the digital age including films, tv, music, magazines, books, and comics.

You can subscribe on iTunes, listed online with Overcast, or by directing your podcast app of choice1 to our XML Feed. Alternatively, you can download the MP3 files directly from The Divide website.

These first few episodes, whilst not perfect2, have been a lot of fun to record and hopefully you’ll enjoy them. If you have feedback, questions, or want to suggest a topic, you can chat to us on Twitter via @PodcastDivide. Our next episode should go live on Wednesday 16th December.

  1. I personally use Overcast↩︎

  2. There are a few minor mic issues which we’ve fixed now and our second episode has an unscheduled drop-in from a hungry toddler. ↩︎

HomeKit enabled Christmas tree lights with Siri control

Every year we seem to buy a bigger Christmas tree. This year is no exception and it is now proving difficult to maneuver around it to turn the lights on and off. To fix this, I’ve connected my lights up to a Belkin WeMo and I’m running the excellent Homebridge1 server so that I can control it all via Siri:

To get this up and running on your own machine, you’ll need to do the following in the Mac Terminal:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install node
sudo npm install -g homebridge
sudo npm install -g homebridge-wemo
homebridge

This will install brew, install node, install Homebridge, install the WeMo plugin for Homebridge, and then attempt to run Homebridge (which will fail as you have no config file). Next, you’ll want to go to ~/.homebridge and create a config.json file that looks like this:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },
    
    "description": "This is an example configuration file with all supported devices. You can use this as a template for creating your own configuration file containing devices you actually own.",

    "accessories": [
        {
            "accessory": "WeMo",
            "name": "Christmas Tree",
            "description": "This shim supports Belkin WeMo devices on the same network as this server. You can create duplicate entries for this device and change the 'name' attribute to reflect what device is plugged into the WeMo, for instance 'Air Conditioner' or 'Coffee Maker'. This name will be used by Siri. Make sure to update the 'wemo_name' attribute with the EXACT name of the device in the WeMo app itself. This can be the same value as 'name' but it doesn't have to be.",
            "wemo_name": "Christmas Tree"
        }
    ]
}

The important part is to make sure that the wemo_name matches the name of your device within the WeMo app; the name attribute is what you want your device to be called on HomeKit. Run the homebridge command again and you should see that your device is found and Homebridge is running.

Next, you’ll need to get a HomeKit enabled app to run all of this. My recommendation is to use the one that Apple provides to developers, HomeKit Catalog, although that will require you to know how to sideload apps from Xcode. Alternatively you can download the Elgato Eve app. Once you have an app, you’ll need to add the Homebridge using the pin that is in your config file. You can play around with the app and create rooms, scenes, zones, etc, but for now the basic commands should work. If you can turn your device on and off via the HomeKit enabled app, you will be able to activate Siri and say “turn on the Christmas tree”, “turn off the Christmas tree”, and “is the Christmas tree on?”.

Added bonus: if you have an Apple TV, you are signed into iCloud, and you use iCloud keychain, then you’ll be able to use all of these voice commands when you’re outside of your house! It’s a pretty useful way to activate these devices and I have several of them dotted around my home2. Homebridge also supports many other services such as Philips Hue (without the need for their HomeKit bridge) and you can write your own plugins very easily3.

My next task is to dig out some code I wrote last year to turn the tree lights on and off automatically depending on if I’m in the house using an iBeacon…

  1. Hat tip to Luke Redpath for introducing me to Homebridge. ↩︎

  2. After my wife asked me for the 62nd time if she’d left her straighteners plugged in whilst we were driving in the car, I set up the plug near her dresser with a WeMo so she can use Siri to ask “are my straighteners turned on?” and “turn off the straighteners” if need be! ↩︎

  3. I’ve written a very basic plugin for the Prismatik Light Pack↩︎

« Older Entries Newer Entries »