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 View Controllers and Views Creating IBOutlets

2 Answers

Can I see your outlet? Your outlet for this label should be @IBOutlet weak var funFactLabel: UILabel! Your error is telling you that funFactLabel is assigned as a UIView, so when you try to assign text to the "label", it doesn't recognize it. If you have any questions, feel free to reply.

Good Luck, Arnav

alexander88
alexander88
10,824 Points

I'm having the same problem. I realized I didn't make my connection weak so I went and remade it (not sure if you have to go through the linking process shown of if you can just shortcut it and edit solely the code). It's still giving me problems though, saying:

Value of type 'UILabel' has no member 'txt'

This is the code I have currently:

''' import UIKit

class ViewController: UIViewController {

@IBOutlet weak var funFactLabel: UILabel!
override func viewDidLoad() {
    super.viewDidLoad()

   funFactLabel.txt = "Fun Fact!"
}

} '''

imelda cloutier
PLUS
imelda cloutier
Courses Plus Student 2,597 Points

found my answer on youtube. somehow my link from the label to the text disappeared. I just deleted the code and redo the linkage