[swift-users] A sample Rational number type

2016-09-30 Thread Hooman Mehr via swift-users
For anybody who is interested: This gist contains a Rational number implementation for Swift 3.0. It is a single file that you can paste in a playground and take a look, or remove the last few lines and drop the file into your ow

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 >> mailto:swift-users@swift.org>> wrote: >> >> Hi, >> >

[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 g

Re: [swift-users] Swift Package Manager (SPM) Deployment Target

2016-09-30 Thread Keith Smiley via swift-users
Here's the PR that allows you to override this from the command line: https://github.com/apple/swift-package-manager/pull/715 -- Keith Smiley On 09/26, Daniel Dunbar via swift-users wrote: > There isn't yet a builtin way to manage this. When generating an Xcode > project, you can use the undocum

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 > functions for which the lea

Re: [swift-users] Function overload resolution rules

2016-09-30 Thread Vladimir.S via swift-users
On 30.09.2016 15:02, 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 functions for which the least amount of parameters have bee

[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 func

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 Unsafe

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 va

[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] 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 NSString(bytes: bytes, length: leng