标签: swift singleton
我想在Swift中编写一个单例类。
class TheOneAndOnlyKraken { static let sharedInstance = TheOneAndOnlyKraken() private init() {} }
这是我到目前为止所拥有的。我的老师问我是否可以将关键字static更改为class。
两者之间的主要区别是什么?如何将其应用于单例模式?