I am attempting to cast a variable to a different type that is held in a variable or is the return type of a function. Here is the idea:
let i = 1 as type(of: 3.14)
But when I do this, I get a couple of errors:
- Use of undeclared type 'type'
- Consecutive statements on a line must be separated by ';' (This inserts a semi-colon between
typeand(of: 3.14))
And a warning:
- Expression of type
(of: Double)is unused
How to I cast a value to a type that is held in a variable?