How to set the shared URLCache in swift 3?

Jason Hocker picture Jason Hocker · Jul 7, 2016 · Viewed 9.2k times · Source

This is the code we had in Swift 2. What is the Swift 3 version? I don't see a replacement for setShared.

let sharedCache: NSURLCache = NSURLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)
NSURLCache.setSharedURLCache(sharedCache)

Answer

user6669885 picture user6669885 · Aug 3, 2016

This works in Xcode 8 Beta 4

    URLCache.shared = sharedCache