I can\'t find any resources on this, and I\'ve been trying all sorts of stuff, but nothing works.
According to Apple\'s documentation, you round an NSDecimalNumber l
NSDecimalNumberBehaviors is a protocol and thus cannot be instantiated. You need an object of a class conforming to the protocol. Apple provides the class NSDecimalNumberHandler for this purpose, e.g.:
let handler = NSDecimalNumberHandler(roundingMode: NSRoundingMode.RoundBankers, scale: 0, raiseOnExactness: false, raiseOnOverflow: false, raiseOnUnderflow: false, raiseOnDivideByZero: false)
let rounded = dec.decimalNumberByRoundingAccordingToBehavior(handler)
The scale argument is the number of decimals you want, i.e., 0 rounds to an integer.