Cache image heights to reduce popping
This commit is contained in:
@@ -24,12 +24,21 @@ enum Preview {
|
||||
}
|
||||
|
||||
class PreviewCache {
|
||||
var previews: [String: Preview]
|
||||
private var previews: [String: Preview]
|
||||
private var image_heights: [String: CGFloat]
|
||||
|
||||
func lookup(_ evid: String) -> Preview? {
|
||||
return previews[evid]
|
||||
}
|
||||
|
||||
func lookup_image_height(_ evid: String) -> CGFloat? {
|
||||
return image_heights[evid]
|
||||
}
|
||||
|
||||
func cache_image_height(evid: String, height: CGFloat) {
|
||||
self.image_heights[evid] = height
|
||||
}
|
||||
|
||||
func store(evid: String, preview: LPLinkMetadata?) {
|
||||
switch preview {
|
||||
case .none:
|
||||
@@ -41,5 +50,6 @@ class PreviewCache {
|
||||
|
||||
init() {
|
||||
self.previews = [:]
|
||||
self.image_heights = [:]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user