I know that using using JSONDecoder we can convert the downloaded JSON data into class/struct object.
Is there a way to do the same for raw data(NSData)/octect. Since downloaded is not a json, I am getting error.
I have class like this
public struct FileData: Codable{ public var data: Data?
public init (data: Data? = nil){ self.data = data }
}
Is there a way to assign the downloaded data to FileData().data via decoding