//單行單例法ide
static let shareTool = Tool()it
// 私有init避免其餘類嘗試調用class
private override init() {static
super.init()單例
}let
//全局單例法return
private let privateTool = Tool()
class Tool {
class var shareTool: Tool {
return privateTool
}