Posts

Post not yet marked as solved
2 Replies
1.7k Views
I want to use URLCache to make data (e.g. User, Session, Privileges objects) available when offline. I think it is better to manually saving data in file or UserDefaults because it will fit seamlessly with existing code that load stuff from URLs and without extra code. One of my concern is this. In URLCache documentation - https://developer.apple.com/documentation/foundation/urlcache, it says: Note In iOS, the on-disk cache may be purged when the system runs low on disk space, but only when your app is not running. I don't want my on-disk cache to get purged on low disk space. I browse around and see URLCache has a new initializer in iOS 13 that accepts a directory url for on-disk cache. convenience init(memoryCapacity: Int, diskCapacity: Int, directory: URL? = nil) From my understanding, Caches directory gets purged on low disk space. From File System Programming Guide - https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html: In iOS 5.0 and later, the system may delete the Caches directory on rare occasions when the system is very low on disk space. This will never occur while an app is running. However, be aware that restoring from backup is not necessarily the only condition under which the Caches directory can be erased. So, my question is, if I pass a URL that is not a Caches directory URL. Will my on-disk cache survive the low memory purge? If not, is there any other way to achieve it?
Posted
by Thongchai.
Last updated
.
Post not yet marked as solved
4 Replies
5.0k Views
Our app has 72k lines of Swift code in 922 files and 500+ lines of Obj-C code. Our clean build time is about 4 minutes. When changing code in a very minor way, e.g. adding a line in a view controller, our incremental build time is about 2-3 minutes. Which is a lot. We have done many optimizations such as warn-long-expression-type-checking, decrease file size, avoid declaring many types in one file, and reduce 3rd party dependencies. We were able to shave off only about 20 seconds. Which is not very satisfying for me. One thing we are exploring is modularize the code. We tried pulling out our core models code as a Swift Package, which contains like 20-30 types. But our incremental build time doesn't improve in anyway. Is there anything else we can do to improve incremental build time with such a large code base? Will these things works? modularize more parts of the app use binary framework instead of source code framework anything else Below is output of cloc App/. command to show more insights of our code base. cloc App/. - https://developer.apple.com/forums/content/attachment/5b8788ab-86f9-48ff-9f47-317742937183
Posted
by Thongchai.
Last updated
.