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.6k Golang : Convert(cast) []byte to io.Reader type
+8.2k Golang : Scramble and unscramble text message by randomly replacing words
+22.1k Golang : Fix type interface{} has no field or no methods and type assertions example
+18k Golang : Check if directory exist and create if does not exist
+5k Golang : Generate multiplication table from an integer example
+6k Golang : Get Alexa ranking data example
+8.2k Random number generation with crypto/rand in Go
+33.7k Golang : Strip slashes from string example
+18.4k Swift : Convert (cast) Int to int32 or Uint32
+17.3k Golang : Get path name to current directory or folder
+13.8k Golang : How to check for empty array string or string?