How can I get the aspect ratio for the image which comes from the server?
EDIT:If I get many image
in the network, how can I get them by using async function
? and in the block to get their aspect ratio
?
How can I get the aspect ratio for the image which comes from the server?
EDIT:If I get many image
in the network, how can I get them by using async function
? and in the block to get their aspect ratio
?
Once you download the image, create an UIImage instance by using the downloaded data then through size property, you will be able to determine the height and width of the actual image downloaded :
let image = UIImage(data: <imageDownloadeddata>)
let imgWidth = image.size.width
let imgHeight = image.size.height