here's my case - I have a number, for example 5.9, and I want to produce a String like "5 ft, 11 in". Can this be accomplished using MeasurementsFormatter API? I see in deprecated API's sources, LengthFormatter, that this was implemented: https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/LengthFormatter.swift - line 79. However, this API is deprecated and it's method is not what I'm looking for, because I don't convert from meters to ft, in. Any help would be appreciated.
Asked
Active
Viewed 56 times
1
-
What's wrong with `LengthFormatter`? It's not deprecated. – rmaddy Nov 15 '17 at 17:26
-
https://developer.apple.com/documentation/foundation/data_formatting scroll down, it says here it's deprecated. Even if it's not, would it be possible to achieve "X ft, Y in" using this API? – AndrzejZ Nov 15 '17 at 17:28
-
1The class itself is not flagged as deprecated and using it produces no deprecation warnings. But I've seen no way to get ft/in using `MeasurementFormatter`. You might have to split the 5.9 into 5.0 and 0.9 and format each separately and append the results. – rmaddy Nov 15 '17 at 17:31