> On Jun 4, 2016, at 6:25 PM, Matthias Zenger via swift-users 
> <swift-users@swift.org> wrote:
> 
> I wanted to use NSFileHandle (for a use case that requires streaming) and 
> realized that this is an API that cannot really be used in Swift because it's 
> based on Objective-C exceptions.

You’re right, NSFileHandle is a very archaic class (kind of a coelacanth) and 
its I/O methods signal errors by throwing exceptions. It’s almost unique in 
that regard; in general Cocoa APIs are only supposed to throw exceptions for 
programmer errors like assertion failures.

> Are there any alternatives?

NSStream.

—Jens
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to