Add Ability to Reference XIBs from Storyboards

Originator:sethfri
Number:rdar://32020366 Date Originated:05-May-2017 11:28 AM
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Feature (New) Reproducible:Not Applicable
 
Summary:
As a developer, I want to be able to develop a reusable custom view using the power of IB in a XIB file, and use it in multiple places in a storyboard.

Currently, if I want to develop a custom view and use it in a storyboard, I only have 2 options:

1. Create the custom layout in one scene in my storyboard, and copy-paste it into other scenes in my storyboard. This is very error prone, and Auto Layout constraints don't often copy-paste correctly. It's also not scalable when I want to use a custom view in dozens of places in a large app like the Amazon App.
2. Create the custom view entirely in code, and then use IBDesignable for it to show up in my storyboard. This is feasible, but not ideal because I need to maintain more code and don't get the power of IB.

Ideally, I want a third option: To be able to design my custom view entirely in a XIB file, so I can still use IB, but then be able to easily say in my storyboard "use this XIB to layout this view class"

Steps to Reproduce:
N/A

Expected Results:
I can reference a XIB within my storyboard file.

Actual Results:
I can't reference a XIB from my storyboard file. I need to build custom views with code or manually copy-paste them around my storyboard.

Regression:
N/A

Notes:
N/A

Comments

Apple Developer Relations - September 16, 2017 at 7:53 AM

Engineering has requested the following information regarding your bug report: Please try using Container Views and see if that is sufficient. A container view allows you to share a view and view controller from multiple scenes.

My Reply - June 11, 2018 at 3:56 PM

Any update on this?

My Reply - September 18, 2017 at 2:58 PM

That unfortunately doesn't solve the problem for a couple reasons:

  1. I have to embed my custom view in a view controller in order to embed it as a Container View. This is overkill for something like a custom button or label that I want to use all over my storyboard
  2. I can copy a XIB into different projects and reference them independently, but I can't do it with a Container View. #1 is much more of an issue than #2

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!