mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added flag emoji instead of country code in the popup view, and countryCode and flag options to the Text widget (#2916)
This commit is contained in:
@@ -1848,3 +1848,10 @@ public func isWidgetActive(_ defaults: UserDefaults?, _ widgets: [String]) -> Bo
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public func countryFlag(_ code: String) -> String? {
|
||||
let uppercased = code.uppercased()
|
||||
guard uppercased.count == 2 else { return nil }
|
||||
let scalars = uppercased.unicodeScalars.compactMap { UnicodeScalar(127397 + $0.value) }
|
||||
return scalars.count == 2 ? String(String.UnicodeScalarView(scalars)) : nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user