Re:Please put units in names
by windpower on Sunday March 20, 2022 @10:59PM
(#30749680)
Swift is pretty good at this. e.g.:
[ Parent
| on HN ]
In swift I quite like DispatchTimeInterval's approach [1] (see Enumeration Cases). In most of my projects I end up adding a simple extension to TimeInterval to get the same behavior. Which makes reasoning about time very simple eg:
Date().advanced(by: .hours(2) + .seconds(10))
I'm honestly not sure why TimeInterval doesn't include this representation by default.1. https://developer.apple.com/documentation/dispatch/dispatcht...