David David - 1 year ago 146
iOS Question

How to load image from Images.xcassets into a UIImage with swift

I have an image from the

folder and I want to load it into a
programmatically using swift. How can I do this? Anyone done this before? Please give me some code examples!

Answer Source

Here's my code:

@IBOutlet weak var imageView: UIImageView!

override func viewDidLoad() {
    imageView.image = UIImage(named: "Apple")

I created an image view and displayed an image inside it.

Enjoy coding!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download