Skip to content

Instantly share code, notes, and snippets.

@aainaj
Created June 2, 2020 03:40
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 aainaj/6660ac0563850d7e12732cd2214d75b0 to your computer and use it in GitHub Desktop.
Save aainaj/6660ac0563850d7e12732cd2214d75b0 to your computer and use it in GitHub Desktop.
Class using Singleton
final class FeaturedTopics {
private var topics: [String: Any] = [:]
static let shared = FeaturedTopics()
private init() {}
subscript(key: String) -> Any? {
get {
return topics[key]
}
set {
topics[key] = newValue
}
}
func reset() {
topics.removeAll()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment