Equivalent of C-style "Static Local Variable" in Swift
The only work around for this that I've come up with thus far is something that looks like this:

func foo() -&gt; Int {
    struct Holder {
        static var timesCalled = 0
    }
    return ++Holder.timesCalled;
}


It's pretty clunky in my opinion, and I'm not sure why Apple doesn't just allow straight static function variables, but this seems quite a bit cleaner than your approach.