Swift: How to use specific image for different devices?

Simple solution if you want use different images for different devices. For example:

Let’s add suffixes for your files, for example: [email protected] or [email protected] and please see the next extension:

And simple using:

let image = UIImage.imageForSpecificDevice("image")

List of suffixes:

image.png
[email protected]
[email protected]
[email protected]
[email protected]
image~ipad.png
[email protected]

Happy coding!


Original discussion on stackoverflow.