mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 17:50:59 +00:00
21 lines
539 B
Swift
21 lines
539 B
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import Foundation
|
|
|
|
class MockUserDefaults: UserDefaults {
|
|
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)
|
|
}
|
|
}
|
|
|
|
private extension MockUserDefaults {
|
|
private static let suiteName = "com.metatext.metabolist.mock-user-defaults"
|
|
}
|