三个简单步骤让你测试使用系统单例的代码2018-07-17·3 分钟Translation IOS Xcode Swift Singleton原文:Testing Swift code that uses system singletons in 3 easy steps 原作者 @johnsundell 大部分在 Apple 平台开发的 App 都会依赖基于单例的 API。从 UIScreen 到 UIApplication,再到 NSBundle,而 Foundation,UIKit 以及 AppKit 里到处充斥着静态的 API。
避免在 Swift 中使用单例2018-07-16·5 分钟Translation IOS Xcode Swift Singleton原文:Avoiding singletons in Swift 原作者 & Copyright @johnsundell “我知道单例不好,但是…”,这是开发者常常在讨论代码的时候会提到的。貌似社区大家有共识 ── 单例不好。但是同时,包括 Apple 和第三方的 Swift 开发者还是在 App 内部或者共享的 frameworks 里不断在用它们。