# Combining WkWebview scrollPageDown and animation

**URL:** <https://forums.swift.org/t/combining-wkwebview-scrollpagedown-and-animation/63303>\
**Category:** Using Swift\
**Tags:** concurrency, swiftui, animation\
**Created:** [February 23, 2023, 8:21am UTC](https://forums.swift.org/t/combining-wkwebview-scrollpagedown-and-animation/63303 "2023-02-23T08:21:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredap](https://avatars.discourse-cdn.com/v4/letter/f/94ad74/32.png) [@fredap](https://forums.swift.org/u/fredap)\
**Post date:** [February 23, 2023, 8:21am UTC](https://forums.swift.org/t/combining-wkwebview-scrollpagedown-and-animation/63303/1 "2023-02-23T08:21:13Z")

</div>

Hi,

I have a `WkWebView` named `webView` in a `SwiftUI` app. I also have a mechanism to capture the spacebar, and when pushed it will result in executing the following piece of code:

```swift
Task {
    // Left lots of code out for brevity
   await webView.scrollPageDown(self)
}

```

And this works great. The only thing that doesn't work great is that the contents just jumps to the next page and especially when I reach the end of the document it is hard to figure out what the last part was that I just read.

So I want to animate this jump. Somehow combining animation with the async scroll methods doesn't work.

E.g. This doesn't work:

```swift
Task {
    withAnimation {
       await webView.scrollPageDown(self)
    }
}

```

When I compile this code I get the error:

```
Cannot pass function of type '() async -> Void' to parameter expecting synchronous function type

```

Does anyone know how to use animation in combination with an `async` methods?
