mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 18:21:00 +00:00
Optimize custom font
This commit is contained in:
parent
b259b6739e
commit
061791f632
1 changed files with 6 additions and 0 deletions
|
@ -88,11 +88,16 @@ public class Theme: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
private var _cachedChoosenFont: UIFont?
|
||||
public var chosenFont: UIFont? {
|
||||
get {
|
||||
if let _cachedChoosenFont {
|
||||
return _cachedChoosenFont
|
||||
}
|
||||
guard let chosenFontData,
|
||||
let font = try? NSKeyedUnarchiver.unarchivedObject(ofClass: UIFont.self, from: chosenFontData) else { return nil }
|
||||
|
||||
_cachedChoosenFont = font
|
||||
return font
|
||||
}
|
||||
set {
|
||||
|
@ -103,6 +108,7 @@ public class Theme: ObservableObject {
|
|||
} else {
|
||||
chosenFontData = nil
|
||||
}
|
||||
_cachedChoosenFont = nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue