6 Apps in 6 months

For the past few weeks, I’ve had some down time from client projects. It’s always nice when this happens, not only because I’m not stressing trying to get a project finished in time, but also because it gives me time to think more about my ideas, the products I want to build and the things I am passionate about.

I’ve decided to set myself an ambitious target. I want to make 6 business focused iOS apps within 6 months, aiming for 1 every month.

Why you might ask? For me the answer is a simple one. I want to push myself and see what I can do. I’m under no illusions that this will be a huge amount of work, especially because I’ll be undertaking this at the same time as running a business, doing client work and having a personal life (one that I’m quite fond of).

I’ve always believed that if you want something enough, and you work hard enough for it, you can achieve anything. I also believe that you need the right people around you, pushing you, making sure you don’t stray from that goal. For me, those people will be my family, my work colleagues and my blog. Regularly updating my blog will incentivise me to get off my arse and actually do the work. Because when I come round to writing a weekly update, if I haven’t got anything to say, I know I haven’t worked hard enough that week.

As with any mammoth task, it helps to break it down into smaller more digestible chunks – this is no exception. Each app will have 4 milestones (1 per week) that need to be hit in order to stay on track. The milestones will be different to each app of course and I’ll be updating them as I go.

I plan to begin this on the first Monday of each month, beginning March 2nd 2015. Wish me luck, and stay tuned for updates!



Simple audio recording using Swift

Just a quick post on how to get audio recording happening on iOS using Swift.

All you need to do is copy this into your UIViewController.

The code itself is quite self explanatory. Make sure at the top of your class to include the line, “import AVFoundation”, this contains the libraries necessary to interact with the audio file system on iOS.

toggleRecording() – The function to call to toggle your audio recording on/off. You’ll need to setup a button linking to this function.

That’s it. Playing the file back is also quite straight forward, but I’ll include that in a later post.


Microphone input wave like Siri using Swift

In recent weeks I’ve been developing an audio recording app in my spare time, just for fun.

I wanted to be able to implement a Siri like wave that animates in response to sound input via the microphone as below:

siri wave

Luckily I was able to find an Objective-C implementation on Github called SCSiriWaveformView which was very well documented – thanks to Stefan Ceriu for this.

Since I’m focussing mainly on Swift these days, I’ve put together a Swift version including the files downloaded from Github. The full source code is below.

If you’re unsure on how to import and use Objective-C files in Swift, check out my earlier post on how to do this here.



Calling Objective-C from Swift

Until recently I hadn’t had to do this, but I was surprised at how easy it was. There is an excellent post that provides a walkthrough on this over at stackoverflow here.

In summary, the main steps are:

1. Add the Objective-C files to your project (drag and drop), and when prompted to configure an Objective-C bridging header, hit Yes! For example purposes, let’s call the file we’re importing “TestClass”.

2. In the newly created bridging header file (it will be in the format “YourProject-Bridging-Header.h”), add a line: import “TestClass.h”.

3. Then inside a Swift class, all you need to add is: var instanceOfTestClass:TestClass = TestClass()

And that’s it, easy!

Fetch custom photo album using Swift

I had a project recently where I had to parse the photos inside a photo album at runtime. The code for this is surprisingly simple, but if you’ve never done it before it can be an interesting challenge in Swift.

When loading a custom photo album on iOS, we’re in fact fetching a PHAssetCollection that matches a given string. The given string when searching for an album is the album title as it appears in the Photos app. Use the following code to fetch the collection:

Say the app also needs to create the photo album, e.g. if the album does not exist. In order to do this, we can use the following code: