OH: "How do you make a singleton in Swift?"—
Conversation
Replying to
class Test {
class let sharedInstance = Test()
}
Type properties are computed lazily.
Replying to
1
6
Use a nested struct within a class, create a struct level instance, and make a readonly class var returning the instance.
2
Show replies
Replying to



