Interface Builder should recognize NSURL-typed IBInspectables

Originator:mxn
Number:rdar://23134321 Date Originated:15-Oct-2015
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Enhancement Reproducible:Not Applicable
 
Summary:
I am developing a framework that vends a custom view with all the requisite designable and inspectable support, because I’m a big fan of Interface Builder. The view has an NSURL-typed property, `styleURL`, that helps to define the view’s initial contents. IB doesn’t have any URL fields in its inspectors and ignores this property.

The most logical workaround would be to define an NSString-typed `styleURLString` property that converts between NSString and NSURL. However, an inspectable named “Style URL String” would look out of place in the Attributes inspector – in fact, it’s long enough to get truncated to Style URL St…” when the inspector is at its minimum width. My workaround is to name the extra property `styleURL__`, relying on IB to strip out the underscores. This way the inspectable looks like a bona fide URL field. (I put `styleURL__` in a special IB-only header, so programmatic users don’t have to see this horrible hack.)

Given NSURL’s prominence in various Apple APIs, IB should support the use of NSURL-typed inspectables. A simple NSTextField would be sufficient, although it would be great if IB could validate the URL for well-formedness. (Just check whether an NSURL can be initialized with the string.)

This control would be intended for remote URLs, using protocols such as HTTP or HTTPS, or custom protocols. It would not be a great fit for local file: URLs.

Steps to Reproduce:


Expected Results:


Actual Results:


Version:
Xcode 7.1 beta 3 (7B85)
OS X 10.10.5 (14F27)

Notes:

Configuration:


Attachments:

Comments


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!