Hi everybody, i tried different times to extend the DecimalNumber class by @Erel, but without success. Anyone can help me to port this code? I'm not able to use very well Object c
Based on this answer
B4X:
import Foundation
extension NSDecimalNumber {
public func round(_ decimals:Int) -> NSDecimalNumber {
return self.rounding(accordingToBehavior:
NSDecimalNumberHandler(roundingMode: .plain,
scale: Int16(decimals),
raiseOnExactness: false,
raiseOnOverflow: false,
raiseOnUnderflow: false,
raiseOnDivideByZero: false))
}
}
let amount = NSDecimalNumber(string: "123.456")
Based on this answer