This commit is contained in:
eevee
2024-08-09 13:46:38 +03:00
parent 6bc5801315
commit 5ba2b4a659
26 changed files with 324 additions and 405 deletions
@@ -2,10 +2,17 @@ import Foundation
import NaturalLanguage
extension String {
static func ~= (lhs: String, rhs: String) -> Bool {
lhs.firstMatch(rhs) != nil
}
var localized: String {
BundleHelper.shared.localizedString(self)
}
func localizeWithFormat(_ arguments: CVarArg...) -> String{
String(format: self.localized, arguments: arguments)
}
var range: NSRange {
NSRange(self.startIndex..., in: self)
@@ -88,7 +88,7 @@ extension UserDefaults {
static var patchType: PatchType {
get {
if let rawValue = defaults.object(forKey: patchTypeKey) as? Int {
return PatchType(rawValue: rawValue)!
return PatchType(rawValue: rawValue) ?? .requests
}
return .notSet