What is the best approach to combine
all data sources together in one class and add it as one environment object, keeping in mind data might change, therefore objects update the views?
What are the appropriate Bindings to use for:
Services (API fetches): @Published?
Computed variables: Lazy var?
Please refer to the diagram as an example. Thanks.
These questions were good references:
An equivalent to computed properties using @Published in Swift Combine?
So, you should use a layered architecture and you will not have those problems.
each service or repository handles one type of data "Users" for example
now, if you need to combine multiple types of data, like Users and Companies let's say, you need a Usecase layer which will combine all the data
on your viewmodel you only use the usecase layer
One important note, passed objects change between layers, so on service layer you have UserDto (coming from webservice), and UserEntity (coming from DB), the repo will transform those in UserResponse, which you don't know if it's db or webservice and even more the UseCase will transform UserResponse and CompanyReponse into a User object which will be passed to ViewModel and will contain all data required there.
Also, until you get to the viewmodel layer you should not need SwiftUI, if you need it, you are doing something wrong, use Swift Combine to handle data.