I'm trying to use this code in a class though I keep on getting the above message.
let filePath: NSString!
let _fileHandle: NSFileHandle!
let _totalFileLength: CUnsignedLongLong!
init?(filePath: String)
{
if let fileHandle = NSFileHandle(forReadingAtPath: filePath)
{
self.filePath = filePath
self._fileHandle = NSFileHandle(forReadingAtPath: filePath)
self._totalFileLength = self._fileHandle.seekToEndOfFile()
}
else
{
return nil //The error is on this line
}
}
How do fix this so I don't get this error:
All stored properties of a class instance must be initialized before returning nil from an initializer