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 error in ViewController

I am working on the Fun Facts app, and I am getting an error for my "var randomColor = ColorWheel.randomColor ()" and I don't know what I am doing wrong.

Thanks in advance for your help!

kyla

4 Answers

Remove the space between ColorWheel.randomColor and the constructor //()\

Post the code for the ColorWheel Struct? What error are you getting?

We need a bit more information then that.

Here is my complete code:

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var funFactLabel: UILabel!
@IBOutlet weak var funFactButton: UIButton!

let factBook = FactBook()
let colorWheel = ColorWheel()

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() {
    var randomColor = ColorWheel.randomColor ()
    view.backgroundColor = randomColor
    funFactButton.tintColor = randomColor
   funFactLabel.text = factBook.randomFact()
}

}

//**The error is showing up by "var randomColor"

What does the error say?

It says: "Missing argument for parameter #1 in call"