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
+22.4k Golang : Read a file into an array or slice example
+5.5k Golang : Denco multiplexer example
+21.6k Fix "Failed to start php5-fpm.service: Unit php5-fpm.service is masked."
+9.6k Golang : Find and replace data in all files recursively
+10.1k Golang : Resolve domain name to IP4 and IP6 addresses.
+10.1k Golang : Generate random integer or float number
+16.3k Golang : Gzip file example
+15.5k Golang : Generate universally unique identifier(UUID) example
+7.1k Android Studio : AlertDialog to get user attention example
+14.3k Golang : Adding XML attributes to xml data or use attribute to differentiate a common tag name
+11.8k Golang : Display list of countries and ISO codes
+6.6k Golang : Levenshtein distance example