buzzfeed / mattress

iOS Offline Caching for Web Content
MIT License
520 stars 45 forks source link

Issue using Mattress with CocoaPods & Swift 2.3 #43

Open erawhctim opened 7 years ago

erawhctim commented 7 years ago

When including Mattress via CocoaPods and manually specifying the SWIFT_VERSION to 2.3, I get a compilation error with DiskCache.diskPath() (line 457):

if !NSFileManager.defaultManager().fileExistsAtPath(fileURL.absoluteString, isDirectory: &isDir) {
...
}

The issue stems from the fact that NSFileManager.fileExistsAtPath(...) accepts a non-optional string, so fileURL.absoluteString has to be unwrapped.

I pushed a fix to my own fork and raised a PR - just not too sure if my solution is the most ideal given the rest of the context of DiskCache. Let me know what you think 👍