From RayWenderlich's sprite kit tutorial, but written in Swift