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

# rulerView(_:willMove:toLocation:)

Returns a potentially modified location to which the marker should be moved.

## Declaration

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

## Parameters

- `ruler`: The ruler view sending the message.
- `marker`: The marker to be moved.
- `location`: The new location for the marker, in the ruler view’s coordinates.

## Return Value

Return Value The modified location to which the marker should be moved.

## Discussion

Discussion This method ensures that the proposed location of aMarker lies within the appropriate bounds for the receiver’s text container. Appropriate bounds are those of the text container minus its line fragment padding. Typically, the ruler view’s width matches that of its text view.

## See Also

### Supporting the ruler view

- [rulerView(_:didMove:)](appkit/nstextview/rulerview(_:didmove:).md)
- [rulerView(_:shouldMove:)](appkit/nstextview/rulerview(_:shouldmove:).md)
- [rulerView(_:didRemove:)](appkit/nstextview/rulerview(_:didremove:).md)
- [rulerView(_:shouldRemove:)](appkit/nstextview/rulerview(_:shouldremove:).md)
- [rulerView(_:didAdd:)](appkit/nstextview/rulerview(_:didadd:).md)
- [rulerView(_:shouldAdd:)](appkit/nstextview/rulerview(_:shouldadd:).md)
- [rulerView(_:willAdd:atLocation:)](appkit/nstextview/rulerview(_:willadd:atlocation:).md)
- [rulerView(_:handleMouseDownWith:)](appkit/nstextview/rulerview(_:handlemousedownwith:).md)
