NSString+Ex.swift 472 B

123456789101112131415161718192021222324252627
  1. //
  2. // NSString+Ex.swift
  3. // TSLiveWallpaper
  4. //
  5. // Created by 100Years on 2024/12/20.
  6. //
  7. import CommonCrypto
  8. public extension String {
  9. var uiColor: UIColor {
  10. if isEmpty {
  11. return .clear
  12. }
  13. return UIColor.fromHex(self)
  14. }
  15. var uiCGColor: CGColor {
  16. uiColor.cgColor
  17. }
  18. }
  19. public extension String {
  20. var localized:String {
  21. return NSLocalizedString(self, comment: self)
  22. // return self
  23. }
  24. }