Skip to content

Instantly share code, notes, and snippets.

@chrismsimpson
Created October 21, 2020 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismsimpson/19b5794166cb2b81c3eaf5903c239724 to your computer and use it in GitHub Desktop.
Save chrismsimpson/19b5794166cb2b81c3eaf5903c239724 to your computer and use it in GitHub Desktop.
import Foundation
public func cast<T>(from any: Any?) -> T {
guard let type = any as? T else {
fatalError()
}
return type
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment