Sharing @Observable objects through SwiftUI's environment - SnowSeeker SwiftUI Tutorial 5/12

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии •

  • @ecovillaraza
    @ecovillaraza 14 дней назад +1

    Sad to say, Paul, we still need to create a @Bindable in the view's body to establish an environment binding. 😅

  • @firatsirinnn
    @firatsirinnn 8 месяцев назад

    Hey Paul, I hope you are well. I have a question about environment. I have an observable viewModel which has some functions and publishing value. I'm observing this viewModel in only 2 views but I'm using viewModel functions in every view. Should I use this (.environment). if I should use it, should I use this environment macro (Environment(Viewmodel.Self) var vm) for only Viewmodel functions? Thank you so much.