Re: [swift-users] Protocol conformance error

2018-01-17 Thread Nevin Brackett-Rozinsky via swift-users
Because it would break this: func foo (c: T, a: U) { c.test(a) } Nevin On Wed, Jan 17, 2018 at 2:29 AM, Roshan via swift-users < swift-users@swift.org> wrote: > Hi, > > Here is some sample code that gives a protocol conformance error in a > playground: > > protocol A {} > protocol B: A {} > >

[swift-users] protocol conformance question

2018-01-10 Thread Swarbrick, Frank via swift-users
Is there a way I can specify that all integer types conform to MyProtocol without naming them explicitly like this?? protocol MyProtocol {} extension String: MyProtocol {} extension Int: MyProtocol {} extension UInt8: MyProtocol {} [...] I tried the following: extension FixedWidthInteger:

Re: [swift-users] Protocol Conformance

2017-06-19 Thread Karl Wagner via swift-users
> On 20. Jun 2017, at 01:38, Muhammad Tahir Vali via swift-users > wrote: > > Hey all, > > I wanted to know if theres a work around for a problem I am having > > lets say I have a protocol > > protocol Graphable : CustomStringConvertible, Sequence, Collection { >

[swift-users] Protocol Conformance

2017-06-19 Thread Muhammad Tahir Vali via swift-users
Hey all, I wanted to know if theres a work around for a problem I am having lets say I have a protocol protocol *Graphable* : CustomStringConvertible, Sequence, Collection { var vertices : [AnyVertexable] { get set } *var edges: [AnyEdge]? { get set }* } Then I have

Re: [swift-users] Protocol conformance failure

2017-03-21 Thread Slava Pestov via swift-users
Worth mentioning that @objc protocols do conform to themselves as long as they do not have static methods or initializer requirements. However this may be too heavy-handed if a simple overload can do the trick. Slava > On Mar 9, 2017, at 1:10 PM, Guillaume Lessard via swift-users >

Re: [swift-users] Protocol conformance failure

2017-03-09 Thread Guillaume Lessard via swift-users
> On Mar 9, 2017, at 12:46, Edward Connell via swift-users > wrote: > > // Everything compiles fine until this > someFunc(items: items) This is a frequent pain point: protocol existentials cannot stand in for the protocol they represent. Your function wants a concrete

[swift-users] Protocol conformance failure

2017-03-09 Thread Edward Connell via swift-users
The error says ItemProtocol does not conform to ItemProtocol. That doesn't make sense. It seems this should work fine. // It's all clean until the last line protocol ItemProtocol : class { var message: String { get } } // heterogenious types class A : ItemProtocol { var message = "A" } class B