SwiftUI and Large Data

SwiftUI uses a concept referred to as "source of truth." When the source of truth changes, the UI updates to reflect the change. This works fine for small to moderate amounts of data. However, some domains such as genomics work with very large data sets that predominantly reside on disk or network storage. The UI is, at best, a snapshot of a small amount of that data.

Since "source of truth" cannot be an entire genomic data set, what would be a good approach for connecting a SwiftUI interface to such a data set?

It seems to me that the "source of truth" must include functionality that retrieves some subset of the larger data set. As an example, the "source of truth" might page forwards or backwards through the larger data set. Thus, the UI might include buttons for paging. As the "source of truth" is updated, those updates are reflected in the UI.

In summary:

large data set <--> source of truth <--> UI

Does this sound reasonable?

If your data is local, then using CoreData might be an option. Then you'd have only one model.

If your data resides on a remote server/database, then you'd have a local (Swift)UI model, plus the remote data model. In that case you'd need to write the code to manage loading the proper data from remote into your local UI model. Here you have to be careful, that the remote data is the "source of truth", not the data in your local UI model. One way to handle this would be to only update the remote data model and then load/update the UI model (and never modify the UI model other than from the remote model).
SwiftUI and Large Data
 
 
Q