https://www.hackingwithswift.com/example-code/uicolor/how-to-use-an-image-for-your-background-color-with-uicolorpatternimage

        let image :UIImage! = UIImage(named:"connectable_device_ble_pebble")

        view.backgroundColor = UIColor(patternImage: image) 

 

效果如下: