Andrew Bancroft 4/24/2015

Clarifying Swift Access Control (Hint: Swift Isn’t C#)

Read Original

This article clarifies Swift access control modifiers, particularly 'private', by comparing them to C#. The author initially assumed Swift's access control worked like C# but discovered that in Swift, private members are visible to anything defined in the same source file, not just within the type itself. The article covers the semantics of private in both languages, the implications for Swift extensions, and emphasizes that developers should not assume cross-language similarities carry over. It's a technical guide for iOS/macOS developers and those transitioning from C# to Swift.

Clarifying Swift Access Control (Hint:  Swift Isn’t C#)

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

No top articles yet