How to use UIImage instead of UIColor

Currently, I am making custom keyboard as an extension. As I was making it, I was able to specify the background color of the keyboard button. But what I want is to insert a UIImage instead of a UIColor, but it doesn't work. Can anyone tell me? People like Claude 31 who can give me a rough idea, please do not comment and I will report you.

Could you show your present code where you change colour ?

In this tutorial (I did not test yet), they set key images. Could it help ?

https://levelup.gitconnected.com/custom-keyboards-in-ios-affb62668d48

    private func buildKey(_ icon: String) -> UIView {
        let view = UIView()
        view.translatesAutoresizingMaskIntoConstraints = false
        view.backgroundColor = .clear
        let imageView = UIImageView()
        view.addSubview(imageView)
        imageView.translatesAutoresizingMaskIntoConstraints = false
        imageView.widthAnchor.constraint(equalToConstant: 24).isActive = true
        imageView.heightAnchor.constraint(equalToConstant: 24).isActive = true
        imageView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
        imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
        imageView.contentMode = .scaleAspectFit
        imageView.image = .init(systemName: icon, compatibleWith: nil)
        imageView.tintColor = .black
        return view
    }
How to use UIImage instead of UIColor
 
 
Q