---
title: "rulerView(_:willMove:toLocation:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/rulerview(_:willmove:tolocation:)"
---

# rulerView(_:willMove:toLocation:)

Informs the client that aRulerView will move aMarker, an NSRulerMarker already on the ruler view.

## Declaration

```swift
func rulerView(_ ruler: NSRulerView, willMove marker: NSRulerMarker, toLocation location: CGFloat) -> CGFloat
```

## Discussion

Discussion location is the marker’s tentative new location, expressed in the client view’s coordinate system. The value returned by the client view is actually used; the client can simply return location unchanged or adjust it as needed. For example, it may snap the location to a grid. This message is sent repeatedly to the client as the user drags the marker.

## See Also

### Synchronizing with Ruler Views

- [rulerView(_:didAdd:)](appkit/nsview/rulerview(_:didadd:).md)
- [rulerView(_:didMove:)](appkit/nsview/rulerview(_:didmove:).md)
- [rulerView(_:didRemove:)](appkit/nsview/rulerview(_:didremove:).md)
- [rulerView(_:handleMouseDownWith:)](appkit/nsview/rulerview(_:handlemousedownwith:).md)
- [rulerView(_:locationFor:)](appkit/nsview/rulerview(_:locationfor:).md)
- [rulerView(_:pointForLocation:)](appkit/nsview/rulerview(_:pointforlocation:).md)
- [rulerView(_:shouldAdd:)](appkit/nsview/rulerview(_:shouldadd:).md)
- [rulerView(_:shouldMove:)](appkit/nsview/rulerview(_:shouldmove:).md)
- [rulerView(_:shouldRemove:)](appkit/nsview/rulerview(_:shouldremove:).md)
- [rulerView(_:willAdd:atLocation:)](appkit/nsview/rulerview(_:willadd:atlocation:).md)
- [rulerView(_:willSetClientView:)](appkit/nsview/rulerview(_:willsetclientview:).md)
