Fix this iOS swift function

Job ID: 31338317

Budget: $10 – $30 USD

Need to pass image to function and return a string-

+++++++++++++++++++++++++

private func postImage(uploadImage : UIImage ) -> String {

let image = uploadImage
var imageUploadName = ""
var imageData : Data?
if let img = image {
if let data = img.jpegRepresentationData {
imageData = data
imageUploadName = "uploadImage.jpg"
} else if let data = img.pngRepresentationData {
imageData = data
imageUploadName = "uploadImage.png"
}else{
imageData = image?.jpegData(compressionQuality: 0.7)
imageUploadName = "uploadImage.jpg"
}
}

return "somestring"

}
Related categories: iPhone Debugging Swift iOS Development