My parallax effect for UIView is not working at all. I need something like a moving background image on iPhone tilt (pseudo-3D).
let horizontalMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.x", type: .TiltAlongHorizontalAxis)
horizontalMotionEffect.minimumRelativeValue = -50
horizontalMotionEffect.maximumRelativeValue = 50
let verticalMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.y", type: .TiltAlongVerticalAxis)
verticalMotionEffect.minimumRelativeValue = -50
verticalMotionEffect.maximumRelativeValue = 50
let motionEffectGroup = UIMotionEffectGroup()
motionEffectGroup.motionEffects = [horizontalMotionEffect, verticalMotionEffect]
imageView.addMotionEffect(motionEffectGroup)
I've tried to use this code. I've read https://www.hackingwithswift.com/example-code/uikit/how-to-create-a-parallax-effect-in-uikit but my imageView remains static.
I'm using Xcode 11, iOS 13.