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
+8.3k Golang : Check from web if Go application is running or not
+24.8k Golang : How to print rune, unicode, utf-8 and non-ASCII CJK(Chinese/Japanese/Korean) characters?
+13.8k Golang : Activate web camera and broadcast out base64 encoded images
+14.5k Golang : How to shuffle elements in array or slice?
+16.1k Golang : Get sub string example
+16.2k Golang : How to check if input from os.Args is integer?
+8.3k Golang : Qt splash screen with delay example
+6k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+34.2k Golang : Create x509 certificate, private and public keys
+10.3k Golang : How to profile or log time spend on execution?
+10.7k Golang : Bubble sort example
+7.2k Golang : Gargish-English language translator