I load HTML codes into my UIWebView via HTML strings with loadHTMLString function. There are same 1.5 MB of font files in those HTML pages. After first download of fonts, it is using them from RAM, according to cellular data usage statistics. However, when I turn off the app from task manager, launch and load the UIWebView again, those fonts are being redownloaded again.
I tried running codes below but no luck. This:
URLCache.shared.memoryCapacity = 40 * 1024 * 1024
URLCache.shared.diskCapacity = 50 * 1024 * 1024
And this:
let memoryCapacity = 40 * 1024 * 1024
let diskCapacity = 50 * 1024 * 1024
let cache = URLCache(memoryCapacity: memoryCapacity, diskCapacity: diskCapacity, diskPath: nil)
URLCache.shared = cache
So, how can I achieve disk caching for UIWebViews resources that is loading its HTML content via loadHTMLString function, not loadRequest?