I expect this to return a Date object representing the time one hour from now:
Calendar.current.date(byAdding: DateComponents(hour: 1), to: Date())
However it returns nil. This seems like a rather straightforward use of the API so perhaps I have some fundamental misconception about how this API should work?
This only appears to affect the swift command line REPL included with Xcode (version 11.3.1 on macOS Catalina 10.15.3).
Interestingly, wrapping the above code in a print() call forces it to print the correct result. So why is it showing nil?
Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
Target: x86_64-apple-darwin19.3.0