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
Matthew Sharikov
5,767 PointsFun Facts App - IOS
Why doesn't this code work?
// // ViewController.swift // Fun Facts // // Created by Macbook air 11 on 12/16/16. // Copyright © 2016 Macbookair11. All rights reserved. //
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var FunFactLabel: UILabel!
let factProvider = FactProvider() {
override func viewDidLoad()
{
super.viewDidLoad()
funFactLabel.text = factProvider.randomFact()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func showFact() {
funFactLabel.text = factProvider.randomFact()
}
}
1 Answer
Matthew Sharikov
5,767 PointsHi Dan! Removing one of the brackets helped, but not completely.
Matt
Dan Lindsay
39,611 PointsDan Lindsay
39,611 PointsHey Matthew,
It looks like you have an extra { right after FactProvider(). Delete the { and it should work fine.
Hope that helps, Dan