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
+15.4k Golang : How to get hour, minute, second from time?
+20.3k Golang : Time slice or date sort and reverse sort example
+17.9k Golang : Upload big file (larger than 100MB) to AWS S3 with multipart upload
+3.5k Responsive Google Adsense
+11.1k Golang : Get HTTP protocol version example
+3k Golang : Get a list of crosses(instruments) available to trade from Oanda account
+10.3k Golang : Validate email address
+5.7k Javascript : How to check a browser's Do Not Track status?
+12.9k Golang : convert string or integer to big.Int type
+5.1k Golang : Levenshtein distance example
+6.3k Linux/Unix : fatal: the Postfix mail system is already running
+29.2k Golang : Call a function after some delay(time.Sleep and Tick)