Skip to content

Instantly share code, notes, and snippets.

View abhijithpp's full-sized avatar
🎯
Focusing

Abhijith abhijithpp

🎯
Focusing
View GitHub Profile
@abhijithpp
abhijithpp / Rounded.swift
Last active January 24, 2023 14:07
A property wrapper to round decimal value
@propertyWrapper
struct Rounded {
private(set) var value: Decimal = 0.0
let rule: NSDecimalNumber.RoundingMode
let scale: Int
var wrappedValue: Decimal {
get { value }
set { value = roundedDecimal(value:newValue,scale: scale, mode: rule) }
}