The general way in Xcode 6.1 is:
- Create UIImage as a variable
- Create Inserts
- Create a new image based on the original image and inserts, and assign it to the original image
var myImage = UIImage(named: "navbar.png")! let myInsets : UIEdgeInsets = UIEdgeInsetsMake(13, 37, 13, 37) myImage = myImage.resizableImageWithCapInsets(myInsets)
source share