Created
June 7, 2019 20:22
-
-
Save dmytro-anokhin/2fd621c5496500fdef053dede79b0642 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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