Your First iOS and UIKit App · Writing Methods |

This is a companion discussion topic for the original entry at


I have a problem in the Writing Methods video in about 4:05. Why currentValue should convert to Float? I thought currentValue has already declared the type as Int?

Thanks for answering my question in advanced.

The currentValue variable is type Int, because that is how the game is designed. The slider.value, on the other hand, is type Float.

So, you have to convert slider.value to Int when assigning it to currentValue, and you have to convert currentValue to Float when assigning it to slider.value.

1 Like

Thanks for reply. Really helpful.