You can use imageAsset.registerImage()
method:
let scale1x = UITraitCollection(displayScale: 1.0)
let scale2x = UITraitCollection(displayScale: 2.0)
let scale3x = UITraitCollection(displayScale: 3.0)
let image = UIImage(named: "img.png")!
image.imageAsset.registerImage(UIImage(named: "img_2x.png")!, withTraitCollection: scale2x)
image.imageAsset.registerImage(UIImage(named: "img_3x.png")!, withTraitCollection: scale3x)
You can register 2x image for all the scales.
However, I dont think it is good idea to access an image with specific resolution. The idea if 1x, 2x and 3x image set is to let the system to decide which image should be loaded. If you really want to, you might change the name of your 1x, 2x and 3x images to SmileyFace-Small, SmileyFace-regular, SmileyFace-large.
UPDATE:
func imageWithTraitCollection(traitCollection: UITraitCollection) -> UIImage
can reference an image with specific scale:
let image1 = image.imageAsset.imageWithTraitCollection(UITraitCollection(traitsFromCollections: [scale1x]))
let image2 = image.imageAsset.imageWithTraitCollection(UITraitCollection(traitsFromCollections: [scale2x]))
let image3 = image.imageAsset.imageWithTraitCollection(UITraitCollection(traitsFromCollections: [scale3x]))
func imageWithTraitCollection(traitCollection: UITraitCollection) -> UIImage
– Damiandamiani