Wednesday, February 8, 2023
HomeiOS Developmentios - management printed property worth replace in viewmodel in SwiftUI?

ios – management printed property worth replace in viewmodel in SwiftUI?


I’ve a view mannequin class with a number of @Printed properties.

class AddPassaround : ObservableObject {
    @Printed var title: String = ""
    @Printed var reversed : String = ""
    @Printed var password: String = ""
    @Printed var age: String = ""
    @Printed var deal with: String = ""
    @Printed var oneAnotherProperty: String = ""

    init() {
    }
}

Each time any one of many @Printed property is up to date, I name an API. Now there’s one other state of affairs that should replace a number of @Printed properties directly programmatically. One thing like this

viewModel.title = "check"
viewModel.password = "newPassword"
viewModel.oneAnotherProperty = "notUpdateAll"

Now the issue is the API is known as a number of occasions and examine is reloaded a number of occasions. How can I make the API to name solely as soon as on this case solely. It ought to work usually in different circumstances.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments