Skip to content

Instantly share code, notes, and snippets.

@dmytro-anokhin
Created June 7, 2019 20:22
Show Gist options
  • Select an option

  • Save dmytro-anokhin/2fd621c5496500fdef053dede79b0642 to your computer and use it in GitHub Desktop.

Select an option

Save dmytro-anokhin/2fd621c5496500fdef053dede79b0642 to your computer and use it in GitHub Desktop.
struct URLImage : View {
// ...
@ObjectBinding private var imageLoader: ImageLoader
var body: some View {
if let image = imageLoader.image {
return image
}
else {
return placeholder
}
}
}
class ImageLoader : BindableObject {
var image: Image?
func load() {
// ...
}
func cancel() {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment