[swift-evolution] Better Self support with class funcs

Stephen Celis stephen.celis at gmail.com
Tue Dec 15 09:11:51 CST 2015


You can use `self` (and, to initialize, `self.init`) inside a class
function to refer to the class. A riff on your example here:
http://swiftstub.com/914697984/

Stephen

On Tue, Dec 15, 2015 at 6:56 AM, James Campbell via swift-evolution <
swift-evolution at swift.org> wrote:

> Would be great to construct the current class in a class function like so
>
> class func makeMeCheese() -> Self
> {
>  return Self(type: .Cheddar);
> }
>
> --
>  Wizard
> james at supmenow.com
> +44 7523 279 698
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151215/099666d0/attachment.html>


More information about the swift-evolution mailing list