-2

Coming from high-level languages like Visual C, C#, Java, ActionScript where packages are a common and basic thing since their inception, and there were many scalability issues around name collisions and I always thought objective-c as the language not up to date.

Now since we have namespacing available and is implicit across modules, why classes are still prefixed, for instance I was going through this WWDC 16 video Enhancing VoIP Apps with CallKit, and classes are still prefixed with CX, this should be the thing of the past now.

Swift 3.0 does emphasize removing repeated elements, they revised and shortened many function names, is there a way to get rid of this NS prefix or are they going to do something about it or still going to prefix their class libraries just like they did with CallKit. It's still a repetition.

enter image description here

Nitesh Borad
  • 4,583
  • 36
  • 51
user2727195
  • 7,122
  • 17
  • 70
  • 118

1 Answers1

1

Now since we have namespacing available and is implicit across modules, why classes are still prefixed

Because the APIs are written in, and must remain usable by, Objective-C, which has no namespacing.

The NS is now (Swift 3) gone from the Foundation classes, which is certainly something. This is accomplished by putting an "overlay" in front of the Foundation API. In the future, this could be done with other frameworks. (Questions about the future, however, are inappropriate for Stack Overflow, and you are as capable of reading the swift-evolution site as everyone else is.)

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • how can I put "overlay" in from top the Foundation API? how's NS gone from Swift 3, I'm still seeing it in code around. – user2727195 Jul 09 '16 at 04:58
  • can you please answer this http://stackoverflow.com/questions/38219128/gcd-pattern-for-chaining-async-operations-while-piping-the-results – user2727195 Jul 09 '16 at 05:09