Re: swift - making array of subclass of class also conforming to protocol
Re: swift - making array of subclass of class also conforming to protocol
- Subject: Re: swift - making array of subclass of class also conforming to protocol
- From: Quincey Morris <email@hidden>
- Date: Sat, 28 Nov 2015 17:26:24 -0800
- Feedback-id: 167118m:167118agrif8a:167118s_JevKZhdU:SMTPCORP
On Nov 28, 2015, at 10:32 , Quincey Morris <email@hidden> wrote:
>
> It can’t be UIView+MasterControllable (in some syntax), because no such *single* type exists.
One other dopey alternative occurred to me. You could add all the methods from UIView, or just those your app actually uses, directly to the MasterControllable protocol. Your conforming subclasses will of course inherit conformity to these requirements from the real UIView, so there’s no extra work or runtime overhead. If the UIView API ever changes, then you’ll conformance errors in your subclasses the next time you compile.
There are probably hundreds of methods in UIView, but chances are you’ll only need a couple of dozen to be exposed in the enlarged MasterController.
FWIW
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden