Skip to content

Instantly share code, notes, and snippets.

@ytyubox
Created September 8, 2020 05:33
Show Gist options
  • Save ytyubox/224a34546a8938d63b0797c958005d77 to your computer and use it in GitHub Desktop.
Save ytyubox/224a34546a8938d63b0797c958005d77 to your computer and use it in GitHub Desktop.
Markdium-Inheriting existing Class type to support ObservableObject
struct SomeView: View {
@ObservedObject var gamePlayer = UIGamePlayer()
var body: some View {
Button(action: {
self.gamePlayer.exp += 1
}) {
Text(gamePlayer.exp.description)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment