Skip to content

Instantly share code, notes, and snippets.

@alsedi
Created October 22, 2015 12:15
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 alsedi/6c8f5f0e313ea490aa69 to your computer and use it in GitHub Desktop.
Save alsedi/6c8f5f0e313ea490aa69 to your computer and use it in GitHub Desktop.
Simple Class wrapper for Swift structures. Useful for NSNotificationCenter, for example
// Wrapper.swift
// Wrap Swift structure into the class. Useful in some operations with NSFoundation classes,
// e.g. NSNotificationCenter.postNotificationName
// Gist: https://gist.github.com/alsedi/6c8f5f0e313ea490aa69
class Wrapper<T> {
private var value: T
init(_ value: T) { self.value = value }
func unwrap() -> T { return self.value }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment