I have a Realm Sync schema that specifies a field called
"bsonType": "decimal". In Swift, that gets turned into a
Sometimes, the value I store in this field is actually an integer.
I have discovered that I can convert from
Decimal128 by using
Decimal128(integerLiteral: Int64(intValue)) - which feels a bit clumsy, but at least it works.
I have no idea how to turn my
Decimal128 value back into an
Int. (Except maybe by going via a
String… surely not?!)
What is the proper way to convert a
Decimal128 value to and from an
Int value in Swift?