Created
June 2, 2020 03:40
-
-
Save aainaj/6660ac0563850d7e12732cd2214d75b0 to your computer and use it in GitHub Desktop.
Class using Singleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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