Unsure about state restoration and document loading synchronization strategies

In an existing app, I quickly (and wrongly) stored the data of the app using the older state restoration APIs, which worked but of course had a big possibility of data loss. So I migrated the app to use UIDocument(s) and that is working much better.

I decided to maintain the state restoration path for the view restoration. However, one thing that has been troubling and messy is that there are two truths now, so the view controller update code is somewhat messy.

Consider the case of a text document and a scroll view which displays that text: Ordinarily, the document would contain the text, and and the app could save the scroll position using state restoration. When the app launches, first the snapshot is displayed (showing the text scrolled), then the state restoration code would run, so now the app knows the scroll position, then snapshot is removed but the data may not have loaded. So essentially, the app needs to save a portion of the text in order to render the view, but really the user can't edit or scroll because the document hasn't loaded.

I basically have a local structure that contains all the drawable data (edited any time I add a control) and update methods from the document and from state restoration. The actual view controller only draws from the local structure. Does anyone have any strategies to handle this synchronization better?

I'd note that the Apple example on state restoration (below) saves the app data with the state restoration, which is explicitly what the documentation says not to do.

https://developer.apple.com/documentation/uikit/uiviewcontroller/restoring_your_app_s_state
Unsure about state restoration and document loading synchronization strategies
 
 
Q