I have a function that generates the random color. Every time I call the function, it generates the same color. I put the function in viewDidLoad() but it still generates the same color.
`viewDidLoad()` would not be called when your view contoller is shown. As the view controller uses the already loaded view.
Please try moving the random color setting code from `viewDidLoad()` to `viewWillApeear(_:)`.
In some cases, `viewWillApeear(_:)` would not be called neither, so please tell me more details if you cannot make it with `viewWillApeear(_:)`.