Post not yet marked as solved
Post marked as unsolved with 6 replies, 995 views
Suppose I have classes foo and bar:
class foo {
}
class bar: foo {
}
I will never instantiate foo, but I will instantiate bar, and other foo subclasses. (foo will provide some functions for its subclasses to use and potentially override, so it's not something that could be replaced with a protocol, as I understand it.)
Now, suppose that I wanted to define a class variable in foo, that would be available to all subclasses, and I wanted to set the value of that variable at runtime, from outside foo and any of its subclasses. How do I do this? I've been wrestling with all kinds of different syntax and can't figure it out.
Or is there a better way to achieve the same goal in Swift that my brain hasn't grokked yet?