3 ms·
I like this particular example of how easy it can be to make Swift act like it has language-level concurrency features: https://github.com/beeth0ven/BNQueue/blo
by Razengan 11y ago
I like this particular example of how easy it can be to make Swift act like it has language-level concurrency features: https://github.com/beeth0ven/BNQueue/blob/master/BNQueue/BNQueue/BNQueue.swift https://github.com/beeth0ven/BNQueue/blob/master/BNQueue/BNQ...
Some enum and extension magic easily lets you write things like:
Queue.UserInitiated.execute {
let url = NSURL(string: "http://image.jpg")!
let data = NSData(contentsOfURL: url)!
let image = UIImage(data: data)
Queue.Main.execute {
imageView.image = image
}
}
- lobster_johnson 11y agoThat's awesome. Blocks were always my favourite part of Ruby, and I think it's really cool that it has been adopted into Swift and (to a lesser extent) Rust.