Created
October 9, 2022 09:47
-
-
Save ra9r/0b148e70bf2937ee1f91e772fb5a1c3f to your computer and use it in GitHub Desktop.
How to initialize a @StateObject inside an init()
This file contains 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 PumpChangeCardView: View { | |
@StateObject var model: PumpChangeCardViewModel | |
init(_ record: PumpChangeRecord) { | |
self._model = StateObject(wrappedValue: PumpChangeCardViewModel(record)) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment