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 : Get current time from the Internet time server(ntp) example
+33.6k Golang : Proper way to set function argument default value
+11k Use systeminfo to find out installed Windows Hotfix(s) or updates
+16.4k Golang : Gzip file example
+13.9k Golang : Chunk split or divide a string into smaller chunk example
+22.6k Golang : Gorilla mux routing example
+21.8k Golang : Match strings by wildcard patterns with filepath.Match() function
+6.9k Golang : Squaring elements in array
+19k Golang : Delete item from slice based on index/key position
+6.5k Default cipher that OpenSSL used to encrypt a PEM file
+13.7k Golang : Reverse IP address for reverse DNS lookup example
+14.9k Golang : How to get Unix file descriptor for console and file