Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Simple iPhone App with Swift v5 Creating a Data Model Creating a Random Color Model

My code is not working like yours and you din't put your code files in the download this is my worst nightmare

// // ViewController.swift // RandomFact // // Created by logs on 29/09/2019. // Copyright © 2019 Wizard Team. All rights reserved. //

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var randomFactLabel: UILabel!

let randomFactProvider = RandomFactProvider()
let randomBackgroundColorProvider = RandomBackgroundColorProvider()

override func viewDidLoad() {
    // Do any additional setup after loading the view.

    randomFactLabel.text = randomFactProvider.facts[0]

@IBAction func showAnotherFunFact() {

    randomFactLabel.text = randomFactProvider.randomFact()



1 Answer

Gregg Squire
Gregg Squire
14,829 Points

The same way that you are setting the text to the random fact in showAnotherFunFact(), you need to set the background color to the random color.