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.1k Golang : Join lines with certain suffix symbol example
+4.9k Fix ERROR 2003 (HY000): Can't connect to MySQL server on 'IP address' (111)
+32.7k Golang : Integer is between a range
+3.9k Golang : Customize scanner.Scanner to treat dash as part of identifier
+9k Golang : Convert file content to Hex
+15k Golang : Check if a string contains multiple sub-strings in []string?
+12.7k Golang : How to check if your program is running in a terminal
+6.8k Swift : Convert (cast) String to Double
+5.5k Golang : When to use make or new?
+3.8k Golang : A program that contain another program and executes it during run-time
+6.3k Golang : Hue, Saturation and Value(HSV) with OpenCV example