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
+11.7k Golang : GTK Input dialog box examples
+4.9k Golang : Constant and variable names in native language
+5.8k Cash Flow : 50 days to pay your credit card debt
+9k Golang : Intercept and compare HTTP response code example
+28.4k Golang : Read, Write(Create) and Delete Cookie example
+7.3k Golang : Scanf function weird error in Windows
+15k Golang : How do I get the local IP (non-loopback) address ?
+5.1k Golang : Print instead of building pyramids
+13.3k Golang : Increment string example
+11.9k Golang : Convert decimal number(integer) to IPv4 address
+12.2k Golang : How to display image file or expose CSS, JS files from localhost?
+7.7k Golang : How to execute code at certain day, hour and minute?