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
+7.8k Gogland : Where to put source code files in package directory for rookie
+12.2k Golang : Split strings into command line arguments
+14.9k Golang : Find commonalities in two slices or arrays example
+8.8k Golang : How to join strings?
+24k Golang : Fix type interface{} has no field or no methods and type assertions example
+12.4k Golang : Simple client-server HMAC authentication without SSL example
+39.3k Golang : How to read CSV file
+13.2k Golang : Convert(cast) uintptr to string example
+17.9k Golang : Iterate linked list example
+8.4k Golang : Check if integer is power of four example
+7.4k Golang : How to fix html/template : "somefile" is undefined error?
+5.4k Javascript : Shuffle or randomize array example