1
0
mirror of https://github.com/metabolist/metatext synced 2025-01-25 13:09:01 +01:00

22 lines
560 B
Swift
Raw Normal View History

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