I am building a Dungeons and Dragons monster stats app. I have images that represent each monster, and each image needs a different scale size to fit inside the parameters. I added each scale size to the JSON file, but as an int. When I parse the JSON and assign everything to the variable that holds them. I try to convert the Int to a CGFloat, it throws an error. Anyone know what to do?
Can't figure out. how to convert Int to CGFloat
How do you try to ,convert, please show code.
What you have to do, if you get an Int value from JSON
let CGFloatValue = CGFloat(value).
Don't try to cast Int to CGFloat with let CGFloatValue = value as CGFloat
Try:
let floatValue = CGFloat(intValue)