How to prevent updating safeAreaInsets while updating center of view - gesture handling

Updated
Dec 26, 2021 5:43 PM
Created
Dec 26, 2021 4:46 PM
Tags
iOSUIKit.frameworkSwift
Attributes

In this movide, look the top of the view. the padding for safeAreaInsets.top are updating while translation.

this works from like this,

gesture.view!.center.x += translation.x
gesture.view!.center.y += translation.y

How to solve

Use CALayer of the view.

gesture.view!.layer.position.x += translation.x
gesture.view!.layer.position.y += translation.y