You can create a UIColor object using an image pattern by using the UIColor(patternImage:_) method.
UIColor
UIColor(patternImage:_)
btn.backgroundColor = UIColor(patternImage: UIImage(named: "image")!)