ios – Setting a label to a price in Swift on XCode?


I perceive it’s reasonably fundamental, however I’m solely making an attempt to get a grasp on fundamental capabilities.

I’ve produced some code by partially my very own information and partial bits from totally different guides.

I’m not getting any errors, however the label is just not displaying itself as “Textual content”. I consider it’s to do with the order/place my code is put.

Please assist clarify how I can repair this!

Please be aware as effectively:

  • I’ve only a single label known as myLabel (named below the doc part of my the id inspector
  • It’s has the textual content “Loaded” put into it already once I put it in.
  • I’ve no different code anyplace, solely the default new challenge code.
  • I renamed the ViewController to ViewManager to keep away from a category error.

First picture: That is the picture simply so you recognize the placement and different bits. I’ll connect the code too:

Second picture: What I get, with no errors:

Third picture: My foremost storyboard file:

And now it in code:

import UIKit

class ViewController: UIViewController {
   @IBOutlet weak var myLabel: UILabel!
   @IBAction func labelSet() {
       myLabel.textual content = "Textual content"


Leave a Reply

Your email address will not be published. Required fields are marked *