DEV Community

Discussion on: How to bind a function from an ObservableObject in swiftui

Collapse
 
coucoseth profile image
ochieng seth

i found a fix
binding it in ButtonComponent just like i did for loading variable like so

@Binding var userMdl: UserModel
Enter fullscreen mode Exit fullscreen mode

Then in the UserView when calling the ButtonComponent i bind the userModel state object like so..

ButtonComponent(loading: $loading, userMdl: .constant(userModel))
Enter fullscreen mode Exit fullscreen mode