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 Creating a Data Model Finishing Up Our Model

William Bergstein
William Bergstein
2,078 Points

I am getting weird errors and my app won't run because of them even though my code looks right. What's happening here?

// // ViewController.swift // Fun Facts // // Created by William Bergstein on 6/23/15. // Copyright (c) 2015 William Bergstein. All rights reserved. //

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var funFactLabel: UILabel!

let factBook = FactBook()

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
   funFactLabel.text = factBook.randomFact()

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

 @IBAction func showFunFact() {
    funFactLabel.text = factBook.randomFact()
}

}

*

//Here is my code can some one tell me what is wrong. I am getting 3 errors. One error on the line with override func didReceiveMemoryWarning() telling me to delete override. another error on the @IBAction func showFunFact() line telling me to delete IBAction and third error after my code where the star is telling me "expected declaration"