Coding in Swift right now. In terms of performance and memory usage, which way is superior? Any other things to take into consideration? Thanks!
Edit: I have read this Difference between static function and singleton class in swift but I still do not understand the difference. Is there a definitive rationale for the extra complexity of a singleton?
1) the regular singleton
class MyClass {
private init() {}
static let shared = MyClass()
func myFunc() {...}
var myVar = ...
}
2) the statics
struct MyStruct {
private init() {}
static func myFunc() {...}
static var myVar = ...
}