[swift-users] What is up with names not being Strings any more in Swift 4?

Jon Shier jon at jonshier.com
Mon Jul 17 11:08:16 CDT 2017


	Making them an extension on String makes them visible everywhere String is used, unless you limit the visibility in some way, which impacts the performance of autocomplete and fills it with random constants. Like I said, part of the reason for this is to separate the constants.



Jon

> On Jul 17, 2017, at 12:04 PM, Manfred Schubert <dev at schubert-it.com> wrote:
> 
> 
>> Am 17.07.2017 um 17:47 schrieb Joe Groff <jgroff at apple.com>:
>> 
>> Yeah, this is the intended use pattern for these namespaced constant. You don't need the `rawValue:` label, though:
>> 
>> extension NSImage.Name {
>> static let myImage = Name("myImage")
>> }
> 
> It would be possible to do the same thing as an extension to String without making the default/simple case more complicated. So I would have said this is overkill, but I'm fine with it.
> 
> What remains is the question whether it is possible to create NSBindingNames in a safe way, like from #selector().
> 
> 
> Kind regards,
> 
> Manfred



More information about the swift-users mailing list