NextFaze / FazeKit

A collection of helper functions and extensions for Swift iOS apps
Apache License 2.0
4 stars 8 forks source link

Add disposable pattern ala C# #15

Closed swoolcock closed 4 years ago

swoolcock commented 4 years ago
class Foo: Disposable {
    func dispose() {
        // do something that would normally appear in a defer such as closing a file handle
    }
}

using(Foo()) { foo in
    // do something with foo
}

// dispose() has been automatically called