2020-08-02 22:23:01 +00:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2020-08-09 01:29:05 +00:00
|
|
|
class MockUserDefaults: UserDefaults {
|
2020-08-02 22:23:01 +00:00
|
|
|
convenience init() {
|
|
|
|
self.init(suiteName: Self.suiteName)!
|
|
|
|
}
|
|
|
|
|
|
|
|
override init?(suiteName suitename: String?) {
|
|
|
|
guard let suitename = suitename else { return nil }
|
|
|
|
|
|
|
|
UserDefaults().removePersistentDomain(forName: suitename)
|
|
|
|
|
|
|
|
super.init(suiteName: suitename)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-09 01:29:05 +00:00
|
|
|
private extension MockUserDefaults {
|
|
|
|
private static let suiteName = "com.metatext.metabolist.mock-user-defaults"
|
2020-08-02 22:23:01 +00:00
|
|
|
}
|