# Why does this action method exists?

**URL:** <https://forums.kodeco.com/t/why-does-this-action-method-exists/51976>\
**Category:** iOS\
**Created:** [October 5, 2018, 7:14pm UTC](https://forums.kodeco.com/t/why-does-this-action-method-exists/51976 "2018-10-05T19:14:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaypaustovsky9](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@shaypaustovsky9](https://forums.kodeco.com/u/shaypaustovsky9)\
**Post date:** [October 5, 2018, 7:14pm UTC](https://forums.kodeco.com/t/why-does-this-action-method-exists/51976/1 "2018-10-05T19:14:52Z")

</div>

Hello,

I’ve encountered something interesting in my opinion and would have liked to get some feedback on it.

In “Your First iOS 12 App” course you have the following method :

```
@IBAction func sliderMoved(slider: UISlider) {
    let roundedValue = slider.value.rounded()
    currentValue = Int(roundedValue)
}

```

my question is:  
Why is this method useful and if it is then how? because from what I can see it only reads the value of the slider and updates the “currentValue” variable? which I think could be done inside the “showAlert” method.

Any feedback would be appreciated

Shay

---

<div class="post-metadata">

**Author:** ![jayantvarma](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jayantvarma/32/111768_2.png) [@jayantvarma](https://forums.kodeco.com/u/jayantvarma)\
**Post date:** [October 28, 2018, 5:54am UTC](https://forums.kodeco.com/t/why-does-this-action-method-exists/51976/2 "2018-10-28T05:54:12Z")

</div>

Hi @shaypaustovsky9,  
Your question is quite valid however, the function sliderMoved is the event when the slider is moved by the user. After this other events are triggered. It is safest to set the currentValue here and thereby available for use from here.

Hope that helps,

Jayant

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [March 21, 2019, 11:14am UTC](https://forums.kodeco.com/t/why-does-this-action-method-exists/51976/3 "2019-03-21T11:14:53Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
