<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSClipView/autoscroll(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSClipView(im)autoscroll:"
  },
  "title" : "autoscroll(with:)"
}
-->

# autoscroll(with:)

Scrolls the clip view proportionally to `theEvent`’s distance outside of it.

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

## Discussion

`theEvent`‘s location should be expressed in the window’s base coordinate system (which it normally is), not the receiving [`NSClipView`](/documentation/AppKit/NSClipView). Returns <doc://com.apple.documentation/documentation/Swift/true> if any scrolling is performed; otherwise returns <doc://com.apple.documentation/documentation/Swift/false>.

Never invoke this method directly; instead, the [`NSScrollView`](/documentation/AppKit/NSScrollView)’s document view should repeatedly send itself [`autoscroll(with:)`](/documentation/AppKit/NSView/autoscroll(with:)) messages when the pointer is dragged outside the [`NSScrollView`](/documentation/AppKit/NSScrollView)‘s frame during a modal event loop initiated by a mouse-down event. The [`NSView`](/documentation/AppKit/NSView) class implements [`autoscroll(with:)`](/documentation/AppKit/NSView/autoscroll(with:)) to forward the message to the receiver’s superview; thus the message is ultimately forwarded to the [`NSClipView`](/documentation/AppKit/NSClipView).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)