Skip to content

Instantly share code, notes, and snippets.

@4np
Created August 1, 2024 16:15
Show Gist options
  • Save 4np/fa4eba3412d160f39be8352f5c80b557 to your computer and use it in GitHub Desktop.
Save 4np/fa4eba3412d160f39be8352f5c80b557 to your computer and use it in GitHub Desktop.

Revisions

  1. 4np created this gist Aug 1, 2024.
    17 changes: 17 additions & 0 deletions LocalizedTests.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    import XCTest

    class SomeTests: XCTestCase {
    override class func setUp() {
    super.setUp()
    UserDefaults.standard.set("en_US", forKey: "AppleLocale")
    UserDefaults.standard.set(["en_US"], forKey: "AppleLanguages")
    UserDefaults.standard.synchronize()
    }

    override class func tearDown() {
    super.tearDown()
    UserDefaults.standard.removeObject(forKey: "AppleLocale")
    UserDefaults.standard.removeObject(forKey: "AppleLanguages")
    UserDefaults.standard.synchronize()
    }
    }