title: Coloring image in swift: fatal error: unexpectedly found nil while unwrapping an Optional value
body: <p>Good day. I am not sure what I'm doing wrong in here, but I'm trying to color my image in viewWillAppear and then I when I click on a button it segue to the next controller. However when I colored, it's changing but when typing my button to segue it's breaking. Here's my code:</p>
  
  <pre><code> @IBOutlet weak var welcomeLabel: UILabel!
  @IBOutlet weak var logoImageView: UIImageView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
  }
  
  override func viewWillAppear(_ animated: Bool) {
      super.viewWillAppear(animated)
  
       self.navigationController?.setNavigationBarHidden(true, animated: true)
  
      let logo = UIImage(named: "UnifiedLogo.png")
  
      if let imageForLogo = logo{
          let templateImage = imageForLogo.withRenderingMode(UIImageRenderingMode.alwaysTemplate)
          print(templateImage)
          logoImageView.image = templateImage
          logoImageView.tintColor = UIColor.white
      }
  }
  </code></pre>
  
  <p>and the breaking line is shown in the bellow pic.</p>
  
  <p><a href="https://i.stack.imgur.com/YgEoM.png" rel="nofollow noreferrer">breaking point with error message</a></p>
  
  <p><a href="https://i.stack.imgur.com/aiBb2.png" rel="nofollow noreferrer">debug screen</a></p>
  
  <p>I have checked that outlets are linked and they are all. </p>
  
  <p>Any help will be appreciated.</p>