[swift-users] RawRepresentable bug or intended?

2016-09-28 Thread Adrian Zubarev via swift-users
struct B : RawRepresentable { let rawValue: Int // init?(rawValue: Int) { // // self.rawValue = rawValue // } static let c: B = B(rawValue: 0) static let d: B = B(rawValue: 1) } It seems to me that the memberwise initializer init(rawValue: Int) ignores the fail

Re: [swift-users] Subclass instance passed to closure expecting parent class “cannot convert value of type to expected argument type”

2016-09-28 Thread Mark Lacey via swift-users
> On Sep 28, 2016, at 5:43 PM, Eric Conner via swift-users > wrote: > > Hello all! > > I hope it's not frowned upon to repost a question here from Stack Overflow, > but I have not found help there. In any case, the email gets some nice > formatting out of it :-D. > > I am trying to create

Re: [swift-users] Subclass instance passed to closure expecting parent class “cannot convert value of type to expected argument type”

2016-09-28 Thread Kenny Leung via swift-users
Could it be because ModelListResponse is Generalized while APIResponse is not? -Kenny > On Sep 28, 2016, at 5:43 PM, Eric Conner via swift-users > wrote: > > Hello all! > > I hope it's not frowned upon to repost a question here from Stack Overflow, > but I have not found help there. In any

[swift-users] Subclass instance passed to closure expecting parent class “cannot convert value of type to expected argument type”

2016-09-28 Thread Eric Conner via swift-users
Hello all! I hope it's not frowned upon to repost a question here from Stack Overflow, but I have not found help there. In any case, the email gets some nice formatting out of it :-D. I am trying to create a subclass with a generic type that can be passed into a completion block, but am getting

Re: [swift-users] Updating C-wrapper to Swift 3

2016-09-28 Thread Michael Ilseman via swift-users
> On Sep 28, 2016, at 10:03 AM, John Brownie via swift-users > wrote: > > Thanks for the pointers. Good reading, but I'm still confused. I think that > the first issue is clear to me now, but I don't know what I have to do to > make the closure be seen as satisfying the type of the function p

Re: [swift-users] Updating C-wrapper to Swift 3

2016-09-28 Thread John Brownie via swift-users
Thanks for the pointers. Good reading, but I'm still confused. I think that the first issue is clear to me now, but I don't know what I have to do to make the closure be seen as satisfying the type of the function pointer. It worked in Swift 2.2 as XML_SetEndElementHandler(parser)

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Fritz Anderson via swift-users
On 28 Sep 2016, at 9:29 AM, Dave Reed via swift-users wrote: > > They aren't identical. Here's a good explanation: > > http://useyourloaf.com/blog/swift-3-access-controls/ > Useful, but the OP asks about “global” symbols, which the exampl

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Nevin Brackett-Rozinsky via swift-users
To answer the original question: at file scope the access modifiers `private` and `fileprivate` have exactly the same effect. It does not matter which of them you use there. Nevin On Wed, Sep 28, 2016 at 12:14 PM, Marco S Hyman via swift-users < swift-users@swift.org> wrote: > > > On Sep 28, 2

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Marco S Hyman via swift-users
> On Sep 28, 2016, at 8:04 AM, Jens Alfke via swift-users > wrote: > > >> On Sep 28, 2016, at 12:16 AM, Cao Jiannan via swift-users >> wrote: >> >> I think the Swift team should tell us which is better. > > If one were better than the other, they wouldn’t both exist... > > It depends on w

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Jens Alfke via swift-users
> On Sep 28, 2016, at 12:16 AM, Cao Jiannan via swift-users > wrote: > > I think the Swift team should tell us which is better. If one were better than the other, they wouldn’t both exist... It depends on whether you need to use those entities in other source files in the same module. If you

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Dave Reed via swift-users
> On Sep 28, 2016, at 3:22 AM, Cao Jiannan via swift-users > wrote: > > Should I use private or fileprivate to declare global variables/consts in > Swift 3? e.g. > > fileprivate let a = 1 > fileprivate class SomeClass { > fileprivate b = 0 > } > > or > > private let a = 1 > private clas

Re: [swift-users] Updating C-wrapper to Swift 3

2016-09-28 Thread Quinn "The Eskimo!" via swift-users
On 28 Sep 2016, at 07:29, John Brownie via swift-users wrote: > Where can I read up on how to make the conversion? I recommend reading the whole “Migrating to Swift 2.3 or Swift 3 from Swift 2.2” doc, but for this specific issue you should start with the “UnsafeRawPointer Migration” doc that

[swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Cao Jiannan via swift-users
Should I use private or fileprivate to declare global variables/consts in Swift 3? e.g. fileprivate let a = 1 fileprivate class SomeClass { fileprivate b = 0 } or private let a = 1 private class SomeClass { fileprivate b = 0 } Thanks! If they are identity, then I think the Swift team

[swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Cao Jiannan via swift-users
Should I use private or fileprivate to declare global variables/consts in Swift 3? e.g. fileprivate let a = 1 fileprivate class SomeClass { fileprivate b = 0 } or private let a = 1 private class SomeClass { private b = 0 } Thanks! If they are identity, then I think the Swift team shou

[swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Cao Jiannan via swift-users
Should I use private or fileprivate to declare global variables/consts in Swift 3? e.g. fileprivate let a = 1 fileprivate class SomeClass { fileprivate b = 0 } Or private let a = 1 private class someClass { fileprivate b = 0 } Thanks! I think the Swift team should tell us which is bett