I don't follow. What's a singleton/how? If you mean my example, the whole point/need for the feature is so it's not. I want `.value` to be unique storage for each subclass.
On Wed, Aug 9, 2017 at 7:09 PM, Robert Widmann <[email protected]> wrote: > This is a singleton, it just happens to be in class scope. > > ~Robert Widmann > > > On Aug 9, 2017, at 3:55 AM, Mathew Huusko V via swift-evolution < > [email protected]> wrote: > > > > Curious if class stored properties have ever been discussed (doesn't > seem so..)? > > > > Also, assuming no, and assuming there's a good reason no/they're not > coming anytime soon, what are some patterns people have been using in their > place? I was considering something like.. > > > > class SomeClass { > > private static var _classValues = [SomeClass.Type: Int]() > > > > class var value: Int { > > get { _classValues[self] } > > set { _classValues[self] = newValue } > > } > > } > > > > .. but then I remembered types aren't hashable yet either (so I guess I > need to stringify it first). > > _______________________________________________ > > swift-evolution mailing list > > [email protected] > > https://lists.swift.org/mailman/listinfo/swift-evolution > >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
