Swift : Convert (cast) Int or int32 value to CGFloat
Problem :
How to convert (cast) Int or int32 value to CGFloat type in Swift programming language ?
Solution :
Use the CGFloat() function to convert or cast the Int variable. For example :
let x : Int = 100
var cgfx = CGFloat(x)
or
let x32 : Int32 = 3200
var cgfx32 = CGFloat(x32)
See also : Swift : Convert (cast) Int to int32 or Uint32
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+25.8k Golang : How to read integer value from standard input ?
+11.1k CodeIgniter : How to check if a session exist in PHP?
+22.8k Golang : simulate tail -f or read last line from log file example
+12.3k Golang : Search and extract certain XML data example
+9.4k Golang : Extract or copy items from map based on value
+4.9k Nginx and PageSpeed build from source CentOS example
+6.2k Apt-get to install and uninstall Golang
+14.5k Golang : Missing Bazaar command
+8.4k Golang : Generate Datamatrix barcode
+6.7k Golang : Calculate pivot points for a cross