@stevelhunt If I understand your question correctly you have a view controller and you want to connect it to the tab bar controller. Since I am not sure I fully understand you question I am going to make some assumptions.
You have a swift file with a view controller
You have a view controller setup in the storyboard canvas
You setup a tab bar controller
If these are not true they are your first steps.
Next, control drag from the tab bar controller to the new view controller.
Select view controller from the popup menu.
You are done.
It is a pretty simple task but not very intuitive IMHO.
Hope I was able to help and if I misunderstood anything please let me know.
Your suggestion worked. I wrote the view controller functions in code and forgot that I had to create a physical view controller in the storyboard and link it to the code file!!
Hi. I think my connections are right, and my code is similar to the code above, but I have a black screen on the simulator. Could you tell me what could be wrong?
Here’s my solution going off the documentation at developer.apple.com
The only other thing was to ctrl-drag from tab bar controller to the new view controller in storyboard and update the bar item text, then make sure that the new view controller is wired to custom class: class = WebViewController in my case in the identity inspector.
The code creates the view programmatically, so there’s nothing to drag into the new view controller.