Apple doesn't always stick with decisions like this. In Swift 4.2 (Xcode 10), NSImage.Name
is now just a typealias for String
— it's no longer a special struct. This way you still get some benefits compared to the parameter type just being String
, and don't have to wrap every call site in an initializer.
The remaining lightweight difference in type is a communication from the API designer to the developer, even if it’s not enforced by the compiler. It tells you what kind of values, out of the universe permitted by the type system, make sense for realistic use. It’s like how a parameter of type TimeInterval
permits any Double
, but when you see TimeInterval
there you get the hint that passing, say, the aspect ratio of your screen won’t be anything more than coincidentally meaningful.