How to bring UIView in front of keyboard in Xcode 14 | Swift?

58 Views Asked by At

I am trying to bring a UIView in front of keyboard. It is working fine when compiled and run using Xcode 13, but same piece of code isn't working in Xcode 14 (Using Xcode 14.2). Below is the code I am using:

let customView = UIView(frame: CGRect(x: 100, y: 100, width: 200, height: 200))
customView.backgroundColor = UIColor.clear
customView.layer.zPosition = CGFloat(Float.greatestFiniteMagnitude)
guard let window =  UIApplication.shared.windows.last else { return }
window.addSubview(customView)

Any help would be appreciated!

0

There are 0 best solutions below