Jas*_*ker 16 nsurlcache swift3
这是我们在Swift 2中的代码.什么是Swift 3版本?我没有看到setShared的替代品.
let sharedCache: NSURLCache = NSURLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)
NSURLCache.setSharedURLCache(sharedCache)
Run Code Online (Sandbox Code Playgroud)
Olu*_*ayo 12
这是Swift 3中的一个示例,将缓存大小增加到500 MB
let memoryCapacity = 500 * 1024 * 1024
let diskCapacity = 500 * 1024 * 1024
let cache = URLCache(memoryCapacity: memoryCapacity, diskCapacity: diskCapacity, diskPath: "myDataPath")
URLCache.shared = cache
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8008 次 |
最近记录: |