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
+15.4k Golang : Delete certain files in a directory
+17.5k Golang : How to tell if a file is compressed either gzip or zip ?
+11k Golang : Sieve of Eratosthenes algorithm
+18.5k Golang : How to get hour, minute, second from time?
+16k Golang : Get current time from the Internet time server(ntp) example
+34.2k Golang : Proper way to set function argument default value
+20k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+7.1k Golang : Fibonacci number generator examples
+5.8k Fix yum-complete-transaction error
+12.5k Golang : Get remaining text such as id or filename after last segment in URL path
+10.4k Golang : Convert file content to Hex