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.