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

Fun 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()
}

}

Hey Matthew,

It looks like you have an extra { right after FactProvider(). Delete the { and it should work fine.

Hope that helps, Dan

1 Answer

Hi Dan! Removing one of the brackets helped, but not completely.

Matt