Explanation of DynamicProperty's update func in SwiftUI

Could an Apple employee that works on SwiftUI please explain the update() func in the DynamicProperty protocol? The docs have ambiguous information, e.g.

"Updates the underlying value of the stored value."

and

"SwiftUI calls this function before rendering a view’s body to ensure the view has the most recent value."

From: https://developer.apple.com/documentation/swiftui/dynamicproperty/update()

How can it both set the underlying value and get the most recent value? What does underlying value mean? What does stored value mean?

E.g. Is the code below correct?


struct MyProperty: DynamicProperty {

    var x = 0

    mutating func update() {
        // get x from external storage
        x = storage.loadX()
   }
}

Or should it be:

struct MyProperty: DynamicProperty {
    let x: Int

    init(x: Int) {
        self.x = x
    }

    func update() {
        // set x on external storage
        storage.save(x: x)
    }
}

This has always been a mystery to me because of the ambigious docs so thought it was time to post a question.

Explanation of DynamicProperty's update func in SwiftUI
 
 
Q