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
+5.3k Golang : Variadic function arguments sanity check example
+16.3k Golang : Fix type interface{} has no field or no methods and type assertions example
+5.8k Golang : Another camera capture GUI application with GTK and OpenCV
+10.4k Golang : Recombine chunked files example
+5k Golang : How to extract video or image files from html source code
+17.7k Golang : How to run Golang application such as web server in the background or as daemon?
+8.7k Golang : Listen and Serve on sub domain example
+6.4k Golang : Create and shuffle deck of cards example
+6.2k Golang : Write multiple lines or divide string into multiple lines
+6.2k Golang : Heap sort example
+4.2k Default cipher that OpenSSL used to encrypt a PEM file
+3.8k Swift : Get substring with rangeOfString() function example