|
The published variable (allTimeScore) does not change on the view "Me" but does on the "home" view. How do I make it chnage on both?
Home View:
Me View:
ContentView:
|
|
hi, i am not sure where these view are in your app ... neither appears to be a subview of the other, not does either navigate to the other ... but your "Home" and "Me" views have independent references to their own saved variables. if these views are independent (say they occur as subviews in a TabView), then the definition of the in general, when you see an
then you're probably doing something wrong. hope that helps, DMG |
|
@delawaremathguy It is connect by a tabView sorry for not including the content View:
|
|
You created two different This is why when one changes, the other is not updated. You need to take a step back, and think about your application's architecture. Q: How do I see the GameVariables() object in a sub view? Q: Can I pass in a reference to the GameVariable() object to more than one view? Q: What if code changes one of the GameVariable() properties? Will the other views see it and respond? See this forums post which answers the same question: |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.