Changes for Swift beta 5 compatibility

This commit is mainly to get everything working again in Xcode 6 beta 5 - may need to revisit things to use the new functionality