I have a project with some legacy networking code that uses the Stream
(formerly NSStream)
family of classes, including Stream,
InputStream,
OutputStream,
and StreamDelegate.
None of these are sendable, so I get a lot of warnings when implementing delegate methods in a @MainActor
class.
These classes seem like they could be sendable. Is this something that will happen soon? Is it a bug I should report?
The networking code that uses these classes runs great, and hasn't needed changes for years, so my current solution is to just mark these unchecked:
extension Stream: @unchecked Sendable { }
extension InputStream: @unchecked Sendable { }
extension OutputStream: @unchecked Sendable { }
This makes the compiler happy, but makes me feel kind of bad. Is there something else I could do?