Question: It is working for navigationBar:

```
var colour = UIColor.red
self.navigationController?.navigationBar.tintColor = colour

```

But do not work for toolbar:

```
self.navigationController?.toolbar.tintColor = colour

```

I searched the internet and stack overflow. No answer is workable for me.
Some people said:

```
self.toolbar.barTintColor = UIColor.redColor()

```

It is also not working for me. (value of type 'thisView' has no member 'toolbar')

I want to edit the toolbar color in coding. No change in the storyboard setting. Thanks.

EDIT:
I am working on adding a toolbar under the webview. Like go back, stop, reload.

[![enter image description here](https://i.stack.imgur.com/lzvQo.png)](https://i.stack.imgur.com/lzvQo.png)

```
    //

    import UIKit

    class ViewController: UIViewController {

    @IBOutlet weak var webView: UIWebView!

    var colour = UIColor.red

    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationController?.navigationBar.tintColor = colour

        // problem in here ..........................
        self.navigationController?.toolbar.tintColor = UIColor.black

        let URL = NSURL(string: "https://www.apple.com")        
        webView.loadRequest(NSURLRequest(url: URL! as URL) as URLRequest)
    }

    @IBAction func backButton(_ sender: AnyObject) {
        webView.goBack()
    }

    @IBAction func nextButton(_ sender: AnyObject) {
        webView.goForward()
    }

    @IBAction func refreshButton(_ sender: AnyObject) {
        webView.reload()
    }

    @IBAction func stopbutton(_ sender: AnyObject) {
        webView.stopLoading()
    }

}

```

Answer: 
If you've just got a toolbar that is on a ViewController in Your Storyboard all you need to do is add an IBOutlet to your View Controller and connect the toolbar in the storyboard to that outlet. This code goes in your ViewController

```
@IBOutlet var toolbar: UIToolbar?

```

Then, in the storyboard, hold the control button and click drag from View Controller (in the left sidebar) to your toolbar. This will create a connection between the toolbar in the storyboard to the toolbar var in your code. After that connection is made all you need to do is set the barTintColor on that toolbar variable like so:

```
self.toolbar.barTintColor = UIColor.blue

```
I wrote this function a few days ago to kinda workaround the fact that you can't change the color.

```
func setStatusBarColor(){
        let view = UIView(frame: CGRect(x: 0.0, y: 0.0, width: UIScreen.main.bounds.size.width, height: 20.0))
        view.backgroundColor = UIColor(red: 81/255, green: 184/255, blue: 222/255, alpha: 1)
        self.view.addSubview(view)
    }

```

Also make sure to set the statusbar to .lightContent

```
UIApplication.sharedApplication().statusBarStyle = .LightContent

```