我来了,swift
简介
通过access modifier控制代码的访问权限,用来隐藏一些不必要的实现细节
所有modifier
Controls | Description |
---|---|
public | declarations are accessible from everywhere |
private | declarations are accessible only within the defined class or struct |
fileprivate | declarations are accessible only within the current swift file |
internal | declarations are accessible only within the defined module (default) |
适用范围
适用于各个类型(class/struct/enum/func/property/initializers/subscripts)
网友评论