mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-23 13:28:50 +01:00
Optimize custom font
This commit is contained in:
parent
b259b6739e
commit
061791f632
@ -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 New Issue
Block a user