Re: Swift function overloading - invoking func with specific parameter (in place of Any parameter) on passing Any object
Re: Swift function overloading - invoking func with specific parameter (in place of Any parameter) on passing Any object
- Subject: Re: Swift function overloading - invoking func with specific parameter (in place of Any parameter) on passing Any object
- From: Andrew Thompson via Cocoa-dev <email@hidden>
- Date: Sun, 27 Oct 2019 10:25:16 -0400
> Is there any other elegant way to achieve the desired behavior without
> using `if-let + typecasting`?
One way is to use classes instead on structs and define display as a method on
those classes. I’m no Swift expert but I expect you may find value in making
display() into a protocol.
Andrew
_______________________________________________
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