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 trialGuillermo Tame
18,583 PointsFatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
I have my code exactly like in the video but every time I run it, it marks my labels as nil. I've rechecked my outlets 3 times and the are all connected to the corresponding labels in the storyboard.
import UIKit
class ContactDetailController: UITableViewController {
var contact: Contact?
//Outlets
@IBOutlet weak var phoneNumberLabel: UILabel!
@IBOutlet weak var emailAddressLabel: UILabel!
@IBOutlet weak var streetAddressLabel: UILabel!
@IBOutlet weak var cityAddressLabel: UILabel!
@IBOutlet weak var stateLabel: UILabel!
@IBOutlet weak var zipCodeLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}
func configureView() {
guard let contact = contact else { return }
phoneNumberLabel.text = contact.phone
emailAddressLabel.text = contact.email
streetAddressLabel.text = contact.street
cityAddressLabel.text = contact.city
stateLabel.text = contact.state
zipCodeLabel.text = contact.zip
}
}