訪問我有一個單例類:確保單屬性不是通過其他實例
final class NotificationSingleton : NSObject {
static let sharedInstance = NotificationSingleton()
var aProperty: String!
var anotherProperty: Int!
}
我怎樣才能確保aProperty
和anotherProperty
只能通過sharedInstance
訪問?
這怎麼能在目標c中實現? –
我不知道這一點 –