Re: [swift-users] Swift 3 version of creating a string from a pointer, length and encoding?

2016-09-30 Thread Quinn "The Eskimo!" via swift-users
On 29 Sep 2016, at 10:47, John Brownie via swift-users wrote: > Or is there a better way that I've missed (highly possible)? I don’t think there’s anything significantly better. The other two options I can think of: * use the `UTF8` codec * use NSString

[swift-users] Passing a pointer to self to C function

2016-09-30 Thread John Brownie via swift-users
Still working on the expat wrapper. The thing I need to do is to pass a pointer to self to be stored in the userData that will be passed to callbacks, allowing me to get at the local instance. I did this in Swift 2.2 as: XML_SetUserData(parser, unsafeBitCast(self, UnsafeMutablePointer.self))

Re: [swift-users] Passing a pointer to self to C function

2016-09-30 Thread Mike Ferenduros via swift-users
The way to do this is via Unmanaged: let raw = Unmanaged.passUnretained(expat).toOpaque() gets you an UnsafeMutableRawPointer you can pass into C functions. You can turn this back into an ExpatSwift with let expat = Unmanaged.fromOpaque(raw).takeUnretainedValue() There are also retained

[swift-users] Function overload resolution rules

2016-09-30 Thread Toni Suter via swift-users
Hi, I am trying to get a better understanding of Swift's function overload resolution rules. As far as I can tell, if there are multiple candidates for a function call, Swift favors functions for which the least amount of parameters have been ignored / defaulted. For example: // Example 1

Re: [swift-users] Passing a pointer to self to C function

2016-09-30 Thread John Brownie via swift-users
Thanks! That works just as it should. It's all compiling and unit tests are passing, so I can move on now. Mike Ferenduros 30 September 2016 at 14:14 The way to do this is via Unmanaged: let raw = Unmanaged.passUnretained(expat).toOpaque() gets you an

[swift-users] Swift migration bug

2016-09-30 Thread Nate Birkholz via swift-users
I found a bug in Swift 2.3 migration in the XCUITests, not sure if the bug goes to swift.org or to Apple. UI test generator uses the syntax (XCUIElement).children(matching: .other) but the compiler only recognizes childrenMatchingType(.Other), and you have to manually change the instances. Makes

Re: [swift-users] Function overload resolution rules

2016-09-30 Thread Mark Lacey via swift-users
> On Sep 30, 2016, at 5:02 AM, Toni Suter via swift-users > wrote: > > Hi, > > I am trying to get a better understanding of Swift's function overload > resolution rules. > As far as I can tell, if there are multiple candidates for a function call, > Swift favors >

Re: [swift-users] Function overload resolution rules

2016-09-30 Thread Toni Suter via swift-users
I created a bug report here: https://bugs.swift.org/browse/SR-2810 Best regards, Toni > Am 30.09.2016 um 19:47 schrieb Mark Lacey : > >> >> On Sep 30, 2016, at 5:02 AM, Toni Suter via swift-users >>