Browse Source

Move string extension method to the right place.

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
668a242654
  1. 5
      Clocker/ClockerUnitTests/ClockerUnitTests.swift
  2. 6
      Clocker/Overall App/AppDefaults.swift
  3. 4
      Clocker/Overall App/String + Additions.swift

5
Clocker/ClockerUnitTests/ClockerUnitTests.swift

@ -430,9 +430,9 @@ class ClockerUnitTests: XCTestCase {
XCTAssertEqual(subject.subviews.count, 2) // Two textfields XCTAssertEqual(subject.subviews.count, 2) // Two textfields
XCTAssertEqual(subject.subviews.first?.layer?.animationKeys(), ["notimezone.emoji"]) XCTAssertEqual(subject.subviews.first?.layer?.animationKeys(), ["notimezone.emoji"])
} }
func testDefaultsWiping() { func testDefaultsWiping() {
let defaultsDict: [String: Any] = ["test1" : "testString", "test2": 24] let defaultsDict: [String: Any] = ["test1": "testString", "test2": 24]
let domainName = "com.test.clocker" let domainName = "com.test.clocker"
let defaults = UserDefaults(suiteName: domainName) let defaults = UserDefaults(suiteName: domainName)
defaults?.setPersistentDomain(defaultsDict, forName: domainName) defaults?.setPersistentDomain(defaultsDict, forName: domainName)
@ -440,5 +440,4 @@ class ClockerUnitTests: XCTestCase {
XCTAssertNil(defaults?.object(forKey: "test1")) XCTAssertNil(defaults?.object(forKey: "test1"))
XCTAssertNil(defaults?.object(forKey: "test2")) XCTAssertNil(defaults?.object(forKey: "test2"))
} }
} }

6
Clocker/Overall App/AppDefaults.swift

@ -51,12 +51,6 @@ class AppDefaults {
} }
} }
extension String {
func localized() -> String {
return NSLocalizedString(self, comment: "Title for \(self)")
}
}
extension UserDefaults { extension UserDefaults {
// Use this with caution. Exposing this for debugging purposes only. // Use this with caution. Exposing this for debugging purposes only.
func wipe(for bundleID: String) { func wipe(for bundleID: String) {

4
Clocker/Overall App/String + Additions.swift

@ -14,4 +14,8 @@ extension String {
return filteredAddress return filteredAddress
} }
func localized() -> String {
return NSLocalizedString(self, comment: "Title for \(self)")
}
} }

Loading…
Cancel
Save