4

I have some constraints that a shuffle around during an animation. After upgrading to XCode9 I tried to make some tweaks, and the editor seems to no longer allow me to add constraints to an constraint collection IBOutlet. I even created a new project and tried to make a simple outlet collection and ran into the same issue. Here's a short video of what I'm talking about:

frustrating xcode footage

I've tried the usual things of deleting derived data, restarting xcode, creating new xibs, praying to the xcode gods...etc. As you can see in the gif, it even happens to me in a brand new project. Anybody else seeing this? Any work-around I'm missing?

I think this is a legit bug, I submitted it to apple.

I'm surprised I don't see anybody else running into this.

Kevin DiTraglia
  • 25,746
  • 19
  • 92
  • 138
  • Can you post an example project? – matt Sep 26 '17 at 00:14
  • @matt the project I have above was literally just a new project I dragged a button on and tried to link it to a outlet collection, the example project doesn't show much, any project will do. – Kevin DiTraglia Sep 26 '17 at 00:49

2 Answers2

13

I had the same issue. This is the only workaround I could find to get it working is to create the Outlet Collection in code (or create the first one by dragging from the storyboard as you're doing). Then drag from the 'add' icon in the ViewController's line margin back to the objects on the storyboard rather than the usual way around.

Drag from the ViewController to the Storyboard

This also seems to be an alternative way: https://stackoverflow.com/a/45597939/1320134

In summary, you need create the first outlet collection as you are currently doing, then drag from the newly created 'referencing outlet collection' in the Connections Inspector to the other objects you want to add to the collection in the storyboard.

svarrall
  • 8,545
  • 2
  • 27
  • 32
  • 2
    Haha, that does work, except they changed the hotkey... to make a link from UI to code it's ctrl+click. To go the other way it's command+click, makes no sense what-so-ever, but at least I can link my outlets! Thanks for the answer. – Kevin DiTraglia Sep 26 '17 at 00:58
  • Xcode 10.1, dragging from the ViewController's `+` back to the Storyboard abject (using ctrl, cmd, or none) simply re-assigns the linked object. It does not prompt me to create a collection. hmmmm – gone Mar 13 '19 at 08:20
1

I tried the same and got the following result. I guess it's working the other way. Check this link out.

Steps:

  1. Drag the required outlet to the view controller file.
  2. Select the outlet collection, name it and add it to view controller class file.
  3. Select the outlet collection created in view controller file from the circle button showing the connection.
  4. Drag from outlet connection to your desired outlet of the same type and it will be automatically added to the same outlet collection.
  5. Or you can do it by going to connection inspector on the utility box on the right-hand side.
  6. Find the desired outlet.
  7. Click on connection circle and drag to the outlet you want to connect and it will be added directly to the outlet collection.

Hope this helps you. Thanks!

Akshay Sunderwani
  • 12,428
  • 8
  • 29
  • 52
  • Thanks, video was helpful, but gonna give the bounty to the other guy since he posted first and it's basically the same answer. – Kevin DiTraglia Sep 26 '17 at 00:59
  • No problem. I understand that. At least that video helped you out. – Akshay Sunderwani Sep 26 '17 at 01:00
  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/17443683) – FluffyKitten Sep 26 '17 at 01:36
  • @FluffyKitten I have updated my answer. Thanks for the suggestion! – Akshay Sunderwani Sep 26 '17 at 02:41