Skip to content

Instantly share code, notes, and snippets.

@RyogaK
Created July 12, 2016 05:50
Show Gist options
  • Save RyogaK/91cbe7f55a66b6a9d8c204859f6b73e5 to your computer and use it in GitHub Desktop.
Save RyogaK/91cbe7f55a66b6a9d8c204859f6b73e5 to your computer and use it in GitHub Desktop.
class Entity {}
struct Token {
let entity = Entity()
}
func asyncProcess() -> Token {
let token = Token()
weak var entity = token.entity
dispatch_async(dispatch_get_main_queue) {
// 重くてキャンセルできない処理
if entity != nil {
// 反映処理
}
}
return token
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment