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
+20.4k Golang : Use TLS version 1.2 and enforce server security configuration over client
+10.7k Golang : md5 hash of a string
+6k Golang : Squaring elements in array
+20.5k Golang : Join arrays or slices example
+7.3k Golang : How to check variable or object type during runtime?
+7.9k Golang : Populate or initialize struct with values example
+25.9k PHP : Count number of JSON items/objects
+10.7k Golang : Perform sanity checks on filename example
+6.4k Golang : How to convert strange string to JSON with json.MarshalIndent
+19.7k Curl usage examples with Golang
+30.1k Golang : Math pow(the power of x^y) example
+18.8k nginx: [emerg] unknown directive "passenger_enabled"