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
+10.9k Golang : Sieve of Eratosthenes algorithm
+17.3k Google Chrome : Your connection to website is encrypted with obsolete cryptography
+10.7k Golang : Get currencies exchange rates example
+7.5k Golang : Shuffle strings array
+9.9k Golang : Sort and reverse sort a slice of integers
+8.1k Golang : HTTP Server Example
+7.7k Golang : Test if an input is an Armstrong number example
+20.9k Golang : Underscore or snake_case to camel case example
+9.1k Golang : How to capture return values from goroutines?
+23.6k Golang : minus time with Time.Add() or Time.AddDate() functions to calculate past date
+11.5k Golang : Change date format to yyyy-mm-dd
+7.1k Restart Apache or Nginx web server without password prompt