[Swift学习] 访问控制 Access Control, private、public、filePrivate等修饰符

private , fileprivate,internal,public,open

从整体看,权限 private < fileprivate < internal < public < open

swift官方定义

Swift Access Control

Swift provides five different access levels for entities within your code. These access levels are relative to the source file in which an entity is defined, and also relative to the module that source file belongs to.

Open access and public access enable entities to be used within any source file from their defining module, and also in a source file from another module that imports the defining module. You typically use open or public access when specifying the public interface to a framework. The difference between open and public access is described below.

Internal access enables entities to be

你可能感兴趣的:(Swift学习,swift,学习,开发语言)