Jul 14, 2023
Better to making the loading condition a state you can switch on.
enum State {
case loading
case loaded([Account])
case empty(String)
case error(String)
}
Done this way, your view is in one and only one state, and you don't need to worry in what order you if test the loading, value, and error variables.
See last example here...
https://betterprogramming.pub/swiftui-view-models-are-not-protocols-8c415c0325b1