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 Linux/Unix : fatal: the Postfix mail system is already running
+8.9k Golang : Get current, epoch time and display by year, month and day
+12.1k Golang : Generate Code128 barcode
+37.6k Golang : How to read CSV file
+8.2k Golang : Extract or copy items from map based on value
+18.7k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+12.9k Golang : Convert IP version 6 address to integer or decimal number
+6.8k Golang : Scan files for certain pattern and rename part of the files
+6.5k Golang : What fmt.Println() can do and println() cannot do
+12.7k Android Studio : Use image as AlertDialog title with custom layout example
+10.5k Golang : Change date format to yyyy-mm-dd
+7.3k Swift : Convert (cast) Character to Integer?