Found the answer to my follow-up question! It's a known and reported bug: https://bugs.swift.org/browse/SR-912
Thanks! On Wed, 15 Mar 2017 at 12:47 Kim Burgestrand <k...@burgestrand.se> wrote: > On Tue, 14 Mar 2017 at 19:50 Joe Groff <jgr...@apple.com> wrote: > > > It shouldn't. Please file a bug, if you haven't already. > > > Will do! I'll file a bug that casting to `Any` first causes different > behavior. > > Follow-up question, looking at the expression `name as! T`, is it > expected to cause a nil-unwrapping runtime error when `name == nil` and `T > == Optional<String>`? Mind you, `(nil as! Optional<String>)` does not > cause an error. > > If the nil-unwrapping error is expected, how can I write it so that it > doesn't, and instead returns nil? > >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users