[英]What is the most memory efficient way to refresh table with data, iOS, Swift 3?
What is the most memory/battery-efficient approach for an app that shows table view with meetings? 对于显示会议桌面视图的应用程序,内存/电池效率最高的方法是什么? Meetings can be eventually updated any moment from third party side (there is no way to be notified about it, it just fetches meetings from iOS native calendar): 会议最终可以从第三方进行更新(无法获得有关它的通知,它只是从iOS本机日历中获取会议):
Refresh screen every minute (thus re-building the same amount of cells that are present on the screen, 5-6 cells at most). 每分钟刷新一次屏幕(从而重新构建屏幕上存在的相同数量的单元格,最多5-6个单元格)。
Fetch meetings in the background, and compare the objects with equatable protocol (object Meeting has references to other objects, that have in turn their own objects, and every level needs to be compared to be sure two objects are equal), and only IF the object has changed, reload table with data? 在后台获取会议,并将对象与等同协议进行比较(对象会对其他对象进行引用,而这些对象又有自己的对象,并且需要比较每个级别以确保两个对象相等),并且仅在对象已更改,用数据重新加载表?
Have you looked into Observing External Changes to the Calendar Database? 您是否考虑过观察日历数据库的外部更改? From Apple's docs: 来自Apple的文档:
An EKEventStore object posts an EKEventStoreChangedNotification notification whenever it detects changes to the Calendar database. 每当EKEventStore对象检测到对Calendar数据库的更改时,它就会发布EKEventStoreChangedNotification通知。 Register for this notification if your app handles event or reminder data. 如果您的应用处理事件或提醒数据,请注册此通知。
That's where I would start --- gotta be a much better way to go about it than to "refresh" every minute... 这就是我将开始---得是一个更好的方法去了解它,而不是“刷新”每一分钟......
ref: https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/EventKitProgGuide/ObservingChanges/ObservingChanges.html#//apple_ref/doc/uid/TP40009765-CH4-SW1 参考: https : //developer.apple.com/library/content/documentation/DataManagement/Conceptual/EventKitProgGuide/ObservingChanges/ObservingChanges.html#//apple_ref/doc/uid/TP40009765-CH4-SW1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.