Search code examples
iosxcodeswiftviewcontrolleriboutlet

IBOutlets on second view controller help on swift


On my first view controller I had no problem creating IBOutlets and Actions, but when I made another view controller, I couldn't make an IBOutlet. There was no blue line when I control dragged it and I couldn't make an IBOutlet and then connect it up either. The first view controller still works. Is it possible to make IBOutlets on two different view controller?


Solution

  • Your view controller must have a custom class file assigned to it in the identity inspector in InterfaceBuilder:

    enter image description here

    Then select the assistant editor and you should be able to ctrl-drag IBOutlets to the associated swift file.