brendon-ai
brendon-ai

Reputation: 527

Distinction between private and fileprivate top-level classes

In Swift 3, what exactly is the difference in access control between

private class Foo { }

and

fileprivate class Bar { }

assuming both are top-level classes, that is, they are placed directly into a file rather than nested in some other construct?

Upvotes: 2

Views: 1138

Answers (1)

Chandler De Angelis
Chandler De Angelis

Reputation: 2766

There is no difference in your case. The only time that fileprivate differs from private is inside a class, struct, or protocol.

Upvotes: 4

Related Questions