4

I am creating a quiz app and for the buttons I need an outlet collection. So far in the array, I only have one button but I want to add the other three. On the other tutorial I've watched, it says to click the button on the side and drag to the thing you want to add (image link below). This doesn't work for me, is there a certain way you need to click? I've done this before, but this time its not working. The difference this time is that I've created a new class. I am not very familiar with Xcode or swift, sorry. Thank you.

enter image description here

matt
  • 515,959
  • 87
  • 875
  • 1,141
Janet Hamrani
  • 79
  • 1
  • 5

2 Answers2

5

Xcode is really buggy as far as outlet connections are concerned. Emptying the Derived Data folder as well as clean / rebuild help. But results could still be problematic. However, the old way to connect things which has been around since before the existence of an Assistant editor still works reliably. Select the ViewController and drag from ITS outlets in the Connection editor to the storyboard items (i.e. buttons).

enter image description here

caxix
  • 1,085
  • 1
  • 13
  • 25
0

Use Interface Builder alone. Use the Identity inspector to make sure your view controller has the correct class, the class where you put your outlet collection property. Now use the Connections inspector for your view controller. You'll see the outlet collection listed there; drag from it to your buttons, one by one.

matt
  • 515,959
  • 87
  • 875
  • 1,141