In my SwiftUI App i have managed to upload file to IPFS but as per the changes of method from GET to POST it broke everything. I am not able able to download image. In postman it returns image but in my code it returns some data but the image is always nil. Is there a workaround for these? or any other viable solution? I am using IPFSKit Library
link for the library:- https://github.com/0xZala/IPFSKit
My code for downloading:
guard let hash = try? fromB58String(urlString.replacingOccurrences(of: "https://ipfs.infura.io:5001/api/v0/cat?arg=", with: "")) else {
print("no hash")
return
}
IPFSClientManager.shared.fetchJSONFromIPFS(hash: hash) { data in
guard let loadedImage = UIImage(data: data) else {
return
}
self.imageCache.set(forKey: self.urlString!, image: loadedImage)
DispatchQueue.main.async {
self.image = loadedImage
}
}