2024-11-21
只能在class内部访问,而不能在外部访问。
class MyClass {
private let filenameTextField: UITextField = UITextField()
func configureTextField() {
filenameTextField.placeholder = "Enter filename"
}
}
class MyClass {
let filenameTextField: UITextField = UITextField()
}
let myClass = MyClass()
myClass.filenameTextField.text = "Some text" // 外部可以直接访问和修改