As stated before it supposed to be per case initialization. You cannot
really have this analogy with other types as they have type and
instance while enums have type, case and instance. But consider this:

struct Struct {
    static let bezierPath: UIBezierPath // shared

    static func initialize() {
        bezierPath = UIBezierPath()
    }
}

On Thu, Jun 2, 2016 at 12:18 AM, Brent Royal-Gordon
<br...@architechies.com> wrote:
>> UIBezierPath is shared for all instances of the enum case. So stored
>> properties are stored per case, not per instance (you have associated
>> values for per instance values).
>>
>>> that isn't really what this syntax suggests is happening
>>
>> Please explain what makes you think that way.
>
> Because you wrote `let bezierPath = UIBezierPath()` in the middle of a type 
> definition, and in all other types, you would get a new bezier path for each 
> instance.
>
>         struct Struct {
>                 let bezierPath = UIBezierPath()         // per instance
>         }
>         class Class {
>                 let bezierPath = UIBezierPath()         // per instance
>         }
>         func function() {
>                 let bezierPath = UIBezierPath()         // per call
>         }
>         enum Enum {
>                 case aCase {
>                         let bezierPath = UIBezierPath() // shared?!?!
>                 }
>         }
>
> --
> Brent Royal-Gordon
> Architechies
>
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to