objective-cswiftmacoscocoazipzap

ZipZap filename issue


I have been playing around with the zipzap framework and i'm having trouble calling the fileName Property. I am able to unzip files with my current set up but i can not name them. This is one way i called it from my program

let archive: ZZArchive = ZZArchive(URL:(fileURLWithPath:PathToZip!), error: &err)
println(archive.entries[0].fileName)

I am getting the error

'fileName()' is unavailable: APIs deprecated as of OS X 10.9 and earlier are unavailable in Swift

/AppKit.NSDocument:9:24: 'fileName()' has been explicitly marked unavailable here

Link to the documentation:

http://pixelglow.github.io/zipzap/api/Classes/ZZArchiveEntry.html#//api/name/fileName

Link to the framework:

https://github.com/pixelglow/zipzap


Solution

  • Had to forcedowncast but this fixed the issue.

    let archive: ZZArchive = ZZArchive(URL:(fileURLWithPath:PathToZip!), error: &err)
    var currentent = archive.entries[1] as ZZArchiveEntry
    println(currentent.fileName)