ctietze,
@ctietze@mastodon.social avatar

question:

StateObject is about ownership;
ObservedObject about, well observing.

What if I inject the instance for the, let's say, "View Model" into the View's initialzier?

Does it still require usage of the StateObject property wrapper, or does ObservedObject somehow magically do the trick?

Asking because a lot of samples use ObservedObject for this case even though the view owns the reference.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • SwiftUI
  • DreamBathrooms
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • tacticalgear
  • anitta
  • ethstaker
  • provamag3
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • modclub
  • megavids
  • normalnudes
  • Leos
  • JUstTest
  • lostlight
  • All magazines