I want to get a relatively formatted string from TimeInterval. So I have tried following code to get custom formatted string:
let ft = DateComponentsFormatter() ft.unitsStyle = .positional ft.zeroFormattingBehavior = .dropAll // TimeInterval can be either 5400 or 3600 or 1800 as well let formattedString = ft.string(from: TimeInterval(1800))
But I can't format my string like this: "1:30h" and if i have only hour "1h" or i have only minutes "30m"
1.4m articles
1.4m replys
5 comments
56.9k users