Swift - UIWebview back button with NavigationBar Back Button
<p>At the moment im using a button on my uiwebview to go back through each webpage that the user searches and its working great. But is there anyway to use the navigation bar back button to go back through previous webpages and when theres no more pages to go back to then open the previous view controller?</p>

<p>Heres the code im using to go back which is just connected to a UIButton.</p>

<pre><code>// Back button events
func onBackButton_Clicked(sender: UIButton)
{
    if(webview.canGoBack)
    {
        webview.goBack()
    }
}
</code></pre>

<p>Any help would be great.</p>