Created
June 7, 2019 20:23
-
-
Save dmytro-anokhin/5e833975ecde1ed8beafa815e3a0808a 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 { | |
| // ... | |
| var body: some View { | |
| if let image = imageLoader.image { | |
| return image | |
| .onAppear {} | |
| .onDisappear {} | |
| } | |
| else { | |
| return placeholder | |
| .onAppear { | |
| self.imageLoader.load() | |
| } | |
| .onDisappear { | |
| self.imageLoader.cancel() | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment