I am working on an app which has a button. The button has no text, image or background.
So what I want to do is to give it an image in the viewDidLoad function.
First I would put the image you wanted inside the Assets.xcassets folder. Just drag it in. Then you can call it whatever you want by double-clicking on it. Lets say that it is called "redTap".
For code you would put:
@IBOutlet var tapButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
let redTapImage = UIImage(named: "redTap")
tapButton.setImage(redTapImage, forState: UIControlState.Normal)
}