Rather surprised to read this this morning…
Conversation
Also interesting that there's no way to write "a subtype of X class and conformer to Y, Z protocols" (like UIView *<SomeProtocol>)
1
Ok, what am I missing? If t conforms to a protocol, why do we care what type it is?
(Genuine question)
1
Replying to
Case I ran into was "my caller is going to pass me a UIView which also conforms to some additional protocol."
Replying to
Ah, you're saying you want both the protocol methods -and- uiview methods then. Usually I'm just concerned w/ the protocol.
1
Right. It's pretty unusual, for sure. Pretty sure I wouldn't have this problem if I were using a designed-for-Swift framework.
1
Replying to
Could you write a UIViewProtocol, make UIView adopt via extension, and then protocol<UIViewProtocol, SomeProtocol>?
1
Not if you need to pass the object to, say, UIView.addSubview(_:).
1
Show replies




