DominikButz/MinimizableView

[Warning] Publishing changes from within view updates is not allowed,

Closed this issue · 2 comments

Publishing changes from within view updates is not allowed, this will cause undefined behavior.

This warning occurs when i start to drag the sheet. I'm using XCode 15, iOS 17

Screenshot 2023-11-07 at 17 19 25

Hi,
thanks for bringing this to my attention. Actually, this warning also appears in the MinimizableViewExample project. The reason is that the view updating logic happens inside the "drag updating" closure.
What you can try is the following: move the updating logic from the dragUpdating closure to the dragOnChanged-closure as shown below. The warning does not seem to appear any more if you use the dragOnChanged-closure instead, at least not in the example project. I hope it helps.

               dragUpdating: { (value, state, _) in
                    
                    
            }, dragOnChanged: { (value) in
                self.dragUpdated(value: value)
            },

fixed, thank!