[swift-users] Flatmap initializer inconsistency
Halen Wooten
swift at hpwooten.com
Mon May 1 12:39:04 CDT 2017
Hi,
I'm seeing a weird issue with using an initializer in flatMap. Here's
an example:
```
let time: TimeInterval? = 662.82582598600004
let intTimeFlatmap = time.flatMap(Int.init) // nil
let intTime = Int(time!) // 662
```
I would expect for the flatMap call to return an optional Int with the
proper value of 662. Is there something I'm misunderstanding, or is
this a swift bug?
Thanks,
Halen
More information about the swift-users
mailing list