Showing/hiding a component when scrolling up and down

Hey guys!
I am working on an application in which I have float search bar at the top of the screen … and after that I have scroll View …
I want the search bar to be hidden (or fade out) when scrolling down … and just showing when scrolling to the top of the page …
any ideas please?

I want to bind the opacity with the Y coordinate … but how to get y coordinate?? !!