[swift-users] private vs. fileprivate on global declaration in Swift3?

Jens Alfke jens at mooseyard.com
Wed Sep 28 10:04:52 CDT 2016


> On Sep 28, 2016, at 12:16 AM, Cao Jiannan via swift-users <swift-users at swift.org> wrote:
> 
> I think the Swift team should tell us which is better.

If one were better than the other, they wouldn’t both exist...

It depends on whether you need to use those entities in other source files in the same module.
If you don’t, use fileprivate. If you do, use private.

—Jens


More information about the swift-users mailing list