Skip to content

Instantly share code, notes, and snippets.

Created June 2, 2017 12:33
What would you like to do?
StateManager Singleton class
class StateManager {
static let sharedInstance = StateManager()
var viewStore: [String: UIView] = [:]
// Associates a view for the given state
public func addView(_ view: UIView, forState state: String, superview: UIView) {
viewStore[state] = view
// Remove all views
public func removeAllViews() {
for (_, view) in self.viewStore {
viewStore = [:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment