---
title: "autoscroll(with:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/autoscroll(with:)"
---

# autoscroll(with:)

Scrolls the view’s closest ancestor NSClipView object proportionally to the distance of an event that occurs outside of it.

## Declaration

```swift
func autoscroll(with event: NSEvent) -> Bool
```

## Parameters

- `event`: An event object whose location should be expressed in the window’s base coordinate system (which it normally is), not the receiving view’s.

## Return Value

Return Value Returns true if any scrolling is performed; otherwise returns false.

## Discussion

Discussion View objects that track mouse-dragged events can use this method to scroll automatically when the cursor is dragged outside of the NSClipView object. Repeated invocations of this method (with an appropriate delay) result in continual scrolling, even when the mouse doesn’t move.

## See Also

### Related Documentation

- [isDescendant(of:)](appkit/nsview/isdescendant(of:).md)
- [autoscroll(with:)](appkit/nsclipview/autoscroll(with:).md)

### Scrolling the View

- [prepareContent(in:)](appkit/nsview/preparecontent(in:).md)
- [preparedContentRect](appkit/nsview/preparedcontentrect.md)
- [scroll(_:)](appkit/nsview/scroll(_:).md)
- [scrollToVisible(_:)](appkit/nsview/scrolltovisible(_:).md)
- [adjustScroll(_:)](appkit/nsview/adjustscroll(_:).md)
- [enclosingScrollView](appkit/nsview/enclosingscrollview.md)
- [scroll(_:to:)](appkit/nsview/scroll(_:to:).md)
- [reflectScrolledClipView(_:)](appkit/nsview/reflectscrolledclipview(_:).md)
- [isCompatibleWithResponsiveScrolling](appkit/nsview/iscompatiblewithresponsivescrolling.md)
