onImage and offImage no longer affect UISwitch , as you discovered :)
You can use instead
onTintColor to set the hue color of the switch when it is on.tintColor to set the hue color of the switch when it is off.thumbTintColor to set thumb tint color.
You can find out more about this.
Here is an example of using these three properties:
@IBOutlet weak var toggleSwitch: UISwitch! { didSet { toggleSwitch.isOn = true toggleSwitch.tintColor = UIColor.red toggleSwitch.onTintColor = UIColor.blue toggleSwitch.thumbTintColor = UIColor.brown } }
What gives me this beautiful switch when turned off

And this is when you turn it on

(I'm a developer, not a designer, if you cannot say;))
So, in your case, you can use the grayscale for onTintColor and tintColor to get this result


Hope this helps.
source share