Quantcast
Channel: User trojanfoe - Stack Overflow
Viewing all articles
Browse latest Browse all 226

Answer by trojanfoe for how to convert optional decimal type to String in swift

$
0
0

If you cast the conversion to Any, then that will work because the compiler is happy that either Decimal or String can used:

import Foundationlet iAmNil: Decimal? = nillet iAmDecimal: Decimal? = 12.34print(String(describing: (iAmDecimal ?? "") as Any))// Prints 12.34\n

Viewing all articles
Browse latest Browse all 226

Trending Articles