Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App with Swift 2.0 View Controllers and Views Creating IBOutlets

Hi I am just wondering what is wrong with this code. I appears the Xcode has updated. Thanks

I have followed the steps I am just wondering if there is a minor error. When i run the app it says that it has failed.

Andres Aguero
Andres Aguero
30,545 Points

Hi Zachary, can you post your code so that we can help you.

Thanks

Muratalin Appas
Muratalin Appas
1,725 Points

Hello,

Try reconnecting the IBoutlet "funFactLabel" from Main.storyboard to ViewController.swift.

2 Answers

William Benson
William Benson
1,119 Points

class ViewController: UIViewController {

@IBOutlet var funFactLabel: UIView!

override func viewDidLoad() {
    super.viewDidLoad()
    funFactLabel.text = "an interesting fact"                        //  this line is giving me the error:

Value type of 'UIView' has no member 'text'

code should go like this. what you have wrong is that you are putting @IBOutlet var funFactLabel: UIView! and it is not UIView is UILabel. @IBOutlet weak var funFactLabel: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()
    funFactLabel.text = "An Intersting fact!"
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

} Hope this help!