While reading someone else's Swift 3 code I came across a private function declared in at the head of a file. By this I mean it is not enclosed in a instancetype. My understanding is that:
Private access restricts the use of an entity to the enclosing declaration
But what is the enclosing declaration here? The module, and if so how does this differ from the default internal? Xcode's intelligence does not seem to "see" this function in other files, so I assume enclosing declaration is not the module.
So as far as I can tell the enclosing declaration is the file itself (which seems odd).
So my questions is, What is the enclosing declaration in this case? And If it is the file how does this differ from fileprivate in this case, and If it is the module how does it differ from internal in this case?
The file is structured as follows:
import Foundation
import otherStuff
private typealias Bar = (new: [Foo], changed: [Foo])
private func fooBar(){
//stuff
}
private func foo() {
// more stuff
}
private final class Bar {
// a hole bunch of stuff
}