IOS swift项目的单例模式.swift5以后的单例模式 不能继承NSObject 第一种写法,最简单 class SoundTools{ static let sharedInstance = SoundTools() private init() { } 第2种写法 class SoundTools