---
title: "registerUnit(withName:abbreviation:unitToPointsConversionFactor:stepUpCycle:stepDownCycle:)"
framework: appkit
role: symbol
role_heading: Type Method
path: "appkit/nsrulerview/registerunit(withname:abbreviation:unittopointsconversionfactor:stepupcycle:stepdowncycle:)"
---

# registerUnit(withName:abbreviation:unitToPointsConversionFactor:stepUpCycle:stepDownCycle:)

Registers a new unit of measurement with the NSRulerView class, making it available to all instances of NSRulerView.

## Declaration

```swift
class func registerUnit(withName unitName: NSRulerView.UnitName, abbreviation: String, unitToPointsConversionFactor conversionFactor: CGFloat, stepUpCycle: [NSNumber], stepDownCycle: [NSNumber])
```

## Discussion

Discussion unitName is the name of the unit in English, in plural form and capitalized by convention—“Inches”, for example. The unit name is used as a key to identify the measurement units and so shouldn’t be localized. abbreviation is a localized short form of the unit name, such as “in” for Inches. conversionFactor is the number of PostScript points in the specified unit; there are 72.0 points per inch, for example. stepUpCycle and stepDownCycle are arrays of NSNumbers that specify how hash marks are calculated, as explained in Setting Up a Ruler View. All numbers in stepUpCycle should be greater than 1.0, those in stepDownCycle should be less than 1.0. NSRulerView supports these units by default:  |  |  |   |  |  |   |  |  |   |  |  |   |  |  |

## See Also

### Altering measurement units

- [measurementUnits](appkit/nsrulerview/measurementunits.md)
- [NSRulerView.UnitName](appkit/nsrulerview/unitname.md)
