title: Detect when UITabBar item selected swift
body: <p>I've added a UITabBar to my app via the interface builder and successfully linked the tabs to Tab Bar Items in other View Controllers, running the app switches between them fine. How would I go about detecting a tab has been pressed? I'd like to call a function in the selected tabs view controller class when selected. As you can probably tell I'm pretty new to swift so explanations are greatly appreciated. </p>
  
  <p>I'm unable to find a recent answer for this and all answers seem to be for non-swift or a very old version of xcode. </p>