Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setDelegate type constraint is too strict #18

Open
dementrock opened this issue Jun 14, 2015 · 2 comments
Open

setDelegate type constraint is too strict #18

dementrock opened this issue Jun 14, 2015 · 2 comments

Comments

@dementrock
Copy link
Contributor

In general, any object may conform to a delegate protocol as long as it implements the required methods. For example, some classes in UIKit may already be conforming to some protocols, but these information are not captured by the Java class hierarchy.

A more specific example: UIViewController actually conforms to UIGestureRecognizerDelegate.

@neocxi
Copy link
Contributor

neocxi commented Jun 14, 2015

I actually like the constraint placed by setDelegate. Usually the optional method/required method thingy could be handled by xxDelegateAdapter. In the case of reusing other classes, I think the best we can do is to model after Xamarin, ie providing a setWeakDelegate(Object) that puts all the trust on developers

@dementrock
Copy link
Contributor Author

That's better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants