Just wanted to let you know this snippet of code was extremely helpful! I just had to make some modifications to my swift compiler settings. I had to change Swift Compiler - Code Generation : Exclusive Access to Memory to No Enforcement. Something you probably want to fix / update in the ReadMe.