In swift3 I have problem to access local files that I downloaded then unzipped.
The path contains "Optional":
Users/name/Library/Developer/CoreSimulator/Devices/..../data/Containers/Data/Application/...
/Documents/Optional("folder-name")/Optional("file-name")
My code to create this path is:
let videoPath = fileManager!.appendingPathComponent("\(MyObj.folder)/\(MyObj.fileName)")
SpeedLog.print(videoPath.path)
The class MyObj is:
class MyObj : NSObject, NSCoding {
var fileName:String!
var folder:String!
required convenience init?(coder decoder: NSCoder) {
self.init()
self.fileName = decoder.decodeObject(forKey: "fileName") as! String
....
}
convenience init(id:Int,fileName:String,...) {
self.init()
self.fileName = fileName
....
}
func encode(with coder: NSCoder) {
if let fileName = fileName { coder.encode(fileName, forKey: "fileName") }
....
}
How to build the path without "Optional?