Posts

Using Swift Package Manager with Carthage

Some users of my libraries have asked how they can integrate these libraries into their applications using Carthage dependency manager.

Carthage requires libraries to provide an Xcode project or a binary framework. However, since many of my Swift libraries are cross-platform, I am not developing them in Xcode. In addition, distributing binary frameworks from Swift source is not recommended by Apple because the Swift ABI is not yet stable. Therefore the frameworks are tied to specific releases of Xcode.

"While distribution and use of 3rd-party binary frameworks is not recommended …

Read more →

Automated CocoaPod releases with CI

Using continuous integration (CI), we can automate releasing our CocoaPods to trunk. When someone tags a new release and runs git push, CI will publish the pod to CocoaPods trunk.

This guide walks you though settings this up on both Circle CI and Travis CI. If you are not using these CI providers, you should be able to follow a similar technique.

CocoaPods trunk Access Token

To release new or updates to existing pods you will need an access token for trunk. This is normally created using the pod trunk …

Read more →

Migrating from OCUnit to XCTest

You might think you were in luck when Xcode offered you an option to migrate to XCTest, but shortly after trying you will discover that this isn't a true migration. Xcode will only migrate your code, it will not update your project to be testable with XCTest. There are still some steps left and unfortunately Apple have not shared any documentation on how to do this.

Note

I have later discovered that it does work as expected, but only if you run the conversion from a project directly. If you try running the conversion from a workspace you will get the problems mentioned above. I have filed this as rdar://16581037 so Apple can fix this in the future. For now, you'll need to follow the below steps.


OCUnit is deprecated, Convert to XCTest


You can follow these steps to migrate your project to XCTest once you've migrated the code with the automatic converter:

Read more →

Memory Management with ARC

This blog post accompanies a talk I recently gave at NSLondon, you can find the slides for this talk here. There will also be a video version of this out shortly, I will post a link once it's out on my Twitter.

ARC is a very powerful feature introduced in Xcode in 4.0, along with various run-time enhancements. With the introduction of ARC, a lot has changed under the hood. The Objective-C run-time has a completely new interface for using many of the old concepts such as autorelease pools …

Read more →

Versioning with Xcode and git

Wouldn't it be great if your iOS or OS X projects just take their version and build number automatically from git? Well, it can!

Using a script in your build phase, you can run a shell to determine the version number and inject this into the Info.plist of a build. It will never modify your local project, just the created build.

GIT_RELEASE_VERSION=$(git describe --tags --always --dirty)
COMMITS=$(git rev-list HEAD | wc -l)
COMMITS=$(($COMMITS))
defaults write "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH%.*}" "CFBundleShortVersionString" "${GIT_RELEASE_VERSION#*v}"
defaults write "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH%.*}" "CFBundleVersion" "${COMMITS}"

Read more →

How does BrowserID work?

This article will explain how the cryptography behind BrowserID works, and lightly cover why BrowserID is a better alternative to OpenID.

A website will ask your browser for a BrowserID assertion via JavaScript. This will either use a native BrowserID API in your browser, or it will use the JavaScript implementation of BrowserID. This is known as the user agent.

navigator.id.get(gotAssertion);

For supporting browsers, the user agent will be supplied and the navigator.id.get method will exist. The user agent can be provided by either the …

Read more →

Organising dotfiles in a git repository

Organising dotfiles can be done in numerous ways. Many dotfile repositories often have their own clunky script to copy or symbolically link their dotfiles in place. I feel this is a dirty approach and I prefer my files to be easily manageable via the git command. I don't want to have to copy a file every time I change it.

Screenshot of organising your dotfiles

Another approach I have seen done, is making your whole home directory a git repository. Unfortunately after using this solution you will come across a number of flaws, any repository …

Read more →

Monitoring InspIRCd with MRTG

This guide will show you how to configure MRTG to show statistics from an InspIRCd IRC server, this will include user counts and channel counts. This guide assumes you already have InspIRCd and MRTG setup and working. You can see an example of this working at Sector 5D.

InspIRCd config

First, you will need to configure InspIRCd to use the m_http and m_http_stats module. I configure InspIRCd to listen on localhost and port 8081 with SSL, but you could pick any port you want, just remember to change the $address …

Read more →

Pre-populating data in the admin panel

I have always found it awkward working with sites and user's in django admin panel. James Bennet from b-list.org explained his way of doing it on his blog, but I found his way a bit limiting, I still want superusers to be able to change the author of a post.

After looking around in the source code for ModelAdmin I found two method's, one of which was not documented. These were formfield_for_manytomany and formfield_for_foreignkey. These methods allow us to supply our own FormField, which could have initial data. These …

Read more →

How to install irssi on Dreamhost

This was a useful guide I wrote back on my old website. I was trying to install irssi, and I couldn't remember how I installed it last time. Luckily it was available on archive.org's WayBackMachine. I have updated this guide to glib-2.19.8 and irssi-0.8.15.

To install irssi, you can eigher follow the next 7 steps and install from source.

Every command on this page should be entered into a SSH Prompt on DreamHost

SSH into your Dreamhost server (for me, this is titan.dreamhost.com …

Read more →