Closed Steven-Chan closed 7 years ago
Example code:
func attachmentFor(image: UIImage) -> SKYAsset { let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] let data = UIImageJPEGRepresentation(image, 0.8) // return SKYAsset(data: data!) // return SKYAsset(name: UUID().uuidString + ".jpg", data: data!) }
The data is generated from UIImageJPEGRepresentation, so I expect the SKYAsset can derive the correct mimeType no matter what, but it can't for neither of the following constructor.
UIImageJPEGRepresentation
SKYAsset
return SKYAsset(data: data!)
return SKYAsset(name: UUID().uuidString + ".jpg", data: data!)
see https://github.com/aidansteele/MagicKit
Example code:
The data is generated from
UIImageJPEGRepresentation
, so I expect theSKYAsset
can derive the correct mimeType no matter what, but it can't for neither of the following constructor.