I would like to count the digit to the right of the decimal point while only being zeros
Input: 1.00000000
Desired Output: 8
Code Tried:
let decimalDigits = String(totalValue).split(separator: ".").last?.count ?? 0
extension Double {
    func decimalCount() -> Int {
        if self == Double(Int(self)) {
            return 0
        }
        let integerString = String(Int(self))
        let doubleString = String(Double(self))
        let decimalCount = doubleString.count - integerString.count - 1
        return decimalCount
    }
}
PSUEDO CODE:
> if to right of decimal all zeros 
> count number of zeros
How would I account for decimal count if all zeros to the right of the decimal?
In the above code I can account for number of decimals. But I cannot account for number of decimals if they are all zeros.
 
     
    