[swift-users] file io in Swift 2.2 for Linux (would like to be pointed in the right direction)

Jens Alfke jens at mooseyard.com
Sun Jun 5 17:55:51 CDT 2016


Looks good, but you'll want some error handling. There's no clean way to integrate it with Generator because the protocol doesn't allow the implementation to throw, unfortunately. (I've run into the same problem building a Generator around a database query.) I think the best solution is to add a property that returns the NSStream.streamError, or a checkError() method that throws the current error if any, and have the caller use those at the end of the iteration.

--Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160605/94b67dfe/attachment.html>


More information about the swift-users mailing list