How to bridge between CoreFoundation and SwiftFoundation on Linux?


(Joe Groff) #1

(including the list this time) AIUI, Core Foundation is an implementation detail of the corelibs implementation of Foundation. It isn't intended to be used directly from Swift code on Linux.

-Joe

···

On Sep 21, 2016, at 1:03 PM, Bouke Haarsma via swift-users <swift-users@swift.org> wrote:

The one that comes with SwiftFoundation (https://github.com/apple/swift-corelibs-foundation/tree/master/CoreFoundation).

I think it should be a bug that CFReadStream cannot be bridged to (NS)InputStream, as otherwise there’s no way to intertwine Sockets (CFSockets) with SwiftFoundation. As the implementation already uses a CFReadStream internally (https://github.com/apple/swift-corelibs-foundation/blob/d3872cb094124d5dd189839505ae73e2fa717cfd/Foundation/NSStream.swift#L122), it would be a matter of adding an initializer. However the value is private, so adding the initializer cannot be done from an extension.