Re: [swift-users] XML parsing on Linux, with Swift 3.1

2017-09-09 Thread Bouke Haarsma via swift-users
On 2017-09-05 06:01:55 +, Georgios Moschovitis via swift-users said: Hi, I would like to parse an RSS feed using Swift 3.1 on Linux. I tried to use Foundations’s XML but I only managed to get segmentation faults. Is this supposed to work on Linux? I have only seen examples on iOS. Apart

Re: [swift-users] Pointer conversions between different sockaddr types

2017-03-21 Thread Bouke Haarsma via swift-users
Hi all (again), It seems the fix is to (only) replace withUnsafePointer with withUnsafeMutablePointer twice. No need to apply the @escaping fixit even. -- Bouke On 2017-03-21 20:52:36 +, Bouke Haarsma via swift-users said: Hi Quinn, and others, I found that this code is still

Re: [swift-users] Pointer conversions between different sockaddr types

2017-03-21 Thread Bouke Haarsma via swift-users
Hi Quinn, and others, I found that this code is still featured on swift.org (https://swift.org/migration-guide/se-0107-migrate.html), but it doesn't compile anymore. There's a fix-it for adding @escaping, but also compile errors due to invalid casts. Can someone have a look at fixing this

[swift-users] Lark: Swift SOAP Client

2017-02-21 Thread Bouke Haarsma via swift-users
Hi all, Over the past few months I've been writing a SOAP client library. It uses code generation to generated the client proxy. The major benefit of code generation is that all messages are typed and great autocompletion support. You can find the project here: https://github.com/Bouke/Lark.

Re: [swift-users] SwiftPM: import ncurses -> conflicting types

2016-12-28 Thread Bouke Haarsma via swift-users
him.h": $ cat shim.h #include "ncurses.h" and change the modulemap to this: $ cat module.modulemap module CNCurses [system] { header "shim.h" link "ncurses" export * } On 29-Dec-2016, at 1:25 AM, Bouke Haarsma via swift-users <swift-users@swift

Re: [swift-users] How to bridge between CoreFoundation and SwiftFoundation on Linux?

2016-09-21 Thread Bouke Haarsma via swift-users
not have > associated CFTypes. That may be because their implementations just started, > but I am not sure what the plan is with those classes and `protocol > _CFBridgeable`. > > > Regards, > Will Stanton > >> On Sep 21, 2016, at 12:38 AM, Bouke Haarsma via swift-users

Re: [swift-users] How to bridge between CoreFoundation and SwiftFoundation on Linux?

2016-09-21 Thread Bouke Haarsma via swift-users
, Jens Alfke <j...@mooseyard.com> wrote: > > >> On Sep 20, 2016, at 9:38 PM, Bouke Haarsma via swift-users >> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >> >> When working with CoreFoundation objects (e.g. CFReadStream, CFWriteSt

Re: [swift-users] Canonical way to cast C structs

2016-09-20 Thread Bouke Haarsma via swift-users
pt for kCFSocketAcceptCallBack and kCFSocketDataCallBack >> callbacks. > > > Thanks, > Bouke > > >> On 14 sep. 2016, at 08:34, Andrew Trick <atr...@apple.com >> <mailto:atr...@apple.com>> wrote: >> >>> >>> On Sep 12, 2016, at

[swift-users] How to bridge between CoreFoundation and SwiftFoundation on Linux?

2016-09-20 Thread Bouke Haarsma via swift-users
Hi all, When working with CoreFoundation objects (e.g. CFReadStream, CFWriteStream) it isn't immediately obvious to me how to bridge them to SwiftFoundation counterparts (InputStream / OutputStream). The following works on OSX, but doesn't work on Linux; let readStream: CFReadStream =

Re: [swift-users] Ubuntu 16.04 support?

2016-09-20 Thread Bouke Haarsma via swift-users
On 2016-09-20 16:37:18 +, Lane Schwartz via swift-users said: In addition to the installation instructions per swift.org, I also needed to install "libpython2.7-dev". When starting the Swift REPL it threw the following error; ...swift/usr/bin/lldb: error while loading shared libraries:

[swift-users] Canonical way to getifaddrs with SPM and Xcode

2016-09-13 Thread Bouke Haarsma via swift-users
Hi all, I would like to know the canonical way to call C’s getifaddrs, defined in ifaddr.h, using Swift 3. It should compile from both Xcode and SPM (Darwin and Glibc). As this header is not imported by the Darwin (/Glibc as well?) library, so the header would need to be imported by my own

Re: [swift-users] Canonical way to cast C structs

2016-09-12 Thread Bouke Haarsma via swift-users
Sorry for all the pings, but it appears that the code below doesn’t work after all; > fatal error: can't unsafeBitCast between types of different sizes So the question remains on how to perform the casts using Swift? — Bouke > On 12 sep. 2016, at 21:37, Bouke Haarsma wrote:

Re: [swift-users] Canonical way to cast C structs

2016-09-12 Thread Bouke Haarsma via swift-users
Sorry, missed the first line when copying: let generic = unsafeBitCast(CFDataGetBytePtr(data), to: sockaddr.self) switch generic.sa_family { case sa_family_t(AF_INET): let ipv4 = unsafeBitCast(generic, to: sockaddr_in.self) //... case sa_family_t(AF_INET6): let ipv6 =

Re: [swift-users] Canonical way to cast C structs

2016-09-12 Thread Bouke Haarsma via swift-users
Ah the missing part of the puzzle appears to be unsafeBitCast(:to:), so the Swift version becomes this: switch generic.sa_family { case sa_family_t(AF_INET): let ipv4 = unsafeBitCast(generic, to: sockaddr_in.self) //... case sa_family_t(AF_INET6): let ipv6 = unsafeBitCast(generic,

Re: [swift-users] New Swift Snapshots Available!

2016-06-21 Thread Bouke Haarsma via swift-users
Should it work with El Capitan? I'm getting the following error: swift :0: error: Swift does not support the SDK 'MacOSX10.11.sdk' On 2016-06-21 01:27:39 +, Mishal Shah via swift-users said: New Swift Snapshots Available! Download new packages from