SwiftUI - data flow theory

When learning from WWDC https://developer.apple.com/videos/play/wwdc2019/226/ , I see this sentence but don’t really get it:

  • View are a function of State, not a sequence of event.

Is there anyone else can help explain it more details for me?

Hi @trungngo,
It simply means that the views can change and some button may be visible, while another hidden and all these changes are based on the state.

For example until you enter the username and the password the Login button could be disabled. So the login button being enabled or disabled is not based on clicking a button but on filling out the details - a state.

hope that helps, if not feel free to ask away again.


This topic was automatically closed after 166 days. New replies are no longer allowed.