SwiftUI Views | raywenderlich.com

Hi Paul,

If you have the compiling issue for converting “Int” to “Double”, as long as you are trying to put a numeric literal (like 20), you can change to something like 20.0. But if you are using a variable, you might need to change the declaration of that or use type cast: Double(your_int_var).

For more information, you may refer to the document: The Basics — The Swift Programming Language (Swift 5.4) and look for this section: Integer and Floating-Point Conversion.

Regards,
David

2 Likes