Singleton with Swift 3.0

前端 未结 6 1695
灰色年华
灰色年华 2021-01-15 04:33

I had this implementation with Swift 2.0 and the Xcode suggestion is not only baffling but causes compilation error as well. it\'s a library where users are passing callfunc

6条回答
  •  长发绾君心
    2021-01-15 05:24

    public class MyClass {
    
        static let sharedInstance = MyClass()
    
        private init() {
            print("MyClass Initialized")
        }
    
    }
    

提交回复
热议问题