'Any way to keep gradient attached at top when scrolling?

I have a scroll view attached to superview(not safe area) and inside it there is a gradient filled view at top. However when i swipe up, the gradient gets pulled down and white background is showed at top of the screen. Adding a gradient behind to cover up doesn't work. Is there any way when I pull down, the gradient expands or something? So the top of it stays connected?Here's how I want it to look when view loads

Here how it looks when I pull down scrollView

Instead I want it to stay connected at top while the bottom of gradient expands if I pull down. I have seen even on twitter app, when you pull down, the header expands and starts to blur. However that seems to be tableView, I want same effect in scrollView without the blur, just the expansion or maybe I won't mind the blur too.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source