No prefix habit

Since I'm new to Swift, I'm reading a lot of tutorial/example code and I
realized people use non prefixed variable name, ie:

class WindowController: NSWindowController {
    ....
}

Is it a good practice since Swift 3 tends to ban the "NS" prefix from its
core class?

The issue here is not so much “banning” as that the reasons for the prefix aren’t relevant in Swift.

In Obj-C, there are no namespaces, so to avoid collisions, frameworks are prefixed with letters to ensure separation. Apple reserved NS, UI and some others for their frameworks and recommended that devs use 3 letter prefixes.

These reasons are not apparent in Swift due to implicit namespacing from modules.

You can feel free to drop prefixes for clarity in Swift.

- Rod

···

On 29 Jun 2016, at 6:01 PM, Martin Delille via swift-users <swift-users@swift.org> wrote:

Since I'm new to Swift, I'm reading a lot of tutorial/example code and I realized people use non prefixed variable name, ie:

class WindowController: NSWindowController {
    ....
}

Is it a good practice since Swift 3 tends to ban the "NS" prefix from its core class?
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users