Search code examples
iosxcodeswiftswift2xcode-storyboard

Swift Input and event handling for storyboards


I've been trying to outline the basic functionality of a swift application I was developing. I created a basic gui with the storyboard functionality that xcode provides. Here is a picture of what it looks like currently: enter image description here

What I want to do next is code up a way to receive and store input from the text fields I outlined in the storyboard. Additionally I want to receive information regarding certain settings that are placed from the switches I outlined in the second screen.

I've been looking through the files that xcode provides me but I haven't been able to find the one that contains the functionality for the storyboards. If someone could point me in the right direction for that i would greatly appreciate it. Ultimately I just want to be able to manage the input provided by the interface I outlined below. Thanks!


Solution

    1. For each view controller on the storyboard make a subclasses of UIViewController.

    2. In the inspector panel on the left of the storyboard set the class of each view controller to their respective subclass of UIViewController.

    3. Open up the .swift file for that view controller and storyboard and ctrl + drag from the textField to the class this will cause a small popup where you can create an IBOutlet or IBAction.