Skip to content

RulerControl is a draggable, resizable UIControl that provides real world length measurement.

License

Notifications You must be signed in to change notification settings

philmitchell/RulerControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

RulerControl

RulerControl is a draggable, resizable UIControl that provides real world length measurement. It supports various units of length, but is most appropriate for measurements in centimeters or inches.

Animation of RulerControl in action

How to use

Measurement in real world units

Set up plane with device ppi:

letdevice=Device() // Open source DeviceKit provides ppi iflet ppi = device.pointsPerInch {letplane=Plane(pointsPerUnit: ppi, unit:.inch) rulerControl.plane = plane rulerControl.baseUnit =.centimeter } rulerControl.addTarget(self, action: #selector(rulerChanged), for:.valueChanged) rulerControl.isContinuous =true

Measurement in relative units

Use just like a slider:

rulerControl.addTarget(self, action: #selector(rulerChanged), for:.valueChanged)

Customizable appearance and behavior

structDefaults{staticletthickness:CGFloat=15.0staticletcolor=UIColor.blue staticlethandleColor=UIColor.blue staticletbaseUnit:DistanceUnit=.centimeter staticlethashMarkColor=UIColor.white staticlethandleSize=CGSize(width:40.0, height:120.0)staticlethandleLineWidth:CGFloat=14.0staticletminimumLineLength:CGFloat=30.0 // Line segment never gets shorter than this staticletisContinuous=falsestaticletshowActual=true}

About

RulerControl is a draggable, resizable UIControl that provides real world length measurement.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages