copy from https://github.com/adamwaite/iOS-Build-Kit