I am new to swift and I am wanting to create a simple chat application using the swiftSocket Library. I want one OSX application that can switch between client mode or server mode. I've created two menu items, 'client' and 'server'. When the application is launched, depending on what menu item is chosen, the appropriate client or server calls will be made. However, I am unsure on how to access the IBAction methods to these menu items in my view controller. How can I handle this?
Asked
Active
Viewed 121 times
1 Answers
0
What it sounds like you need is a Container View. These views can house smaller views, running with independent ViewController logic. Like a separate view within your view. There's a good tutorial here on using Container Views here,
Here's some sample code on how to get a container set up with a View Controller programmatically, but it's just a demo!
let storyboard = UIStoryboard(name: "Main", bundle: nil)
self.controller = storyboard.instantiateViewControllerWithIdentifier(storyboardID)
controller.view.frame = CGRectMake(0, 0, theWidth, theHeight)
self.view.addSubview(controller.view)
self.addChildViewController(controller)
controller.didMoveToParentViewController(self)