---
title: "rulerView(_:willAdd:atLocation:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/rulerview(_:willadd:atlocation:)"
---

# rulerView(_:willAdd:atLocation:)

Informs the client that aRulerView will add the new NSRulerMarker, aMarker.

## Declaration

```swift
func rulerView(_ ruler: NSRulerView, willAdd marker: NSRulerMarker, atLocation 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(_:willMove:toLocation:)](appkit/nsview/rulerview(_:willmove:tolocation:).md)
- [rulerView(_:willSetClientView:)](appkit/nsview/rulerview(_:willsetclientview:).md)
