https://github.com/xcessentials/bytypestorage
Data container that allows to store exactly one instance of any given type.
https://github.com/xcessentials/bytypestorage
data-container swift unique-by-type xcode
Last synced: about 1 year ago
JSON representation
Data container that allows to store exactly one instance of any given type.
- Host: GitHub
- URL: https://github.com/xcessentials/bytypestorage
- Owner: XCEssentials
- License: mit
- Created: 2017-09-03T05:46:38.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-01-23T16:39:06.000Z (over 4 years ago)
- Last Synced: 2025-02-01T21:02:54.477Z (over 1 year ago)
- Topics: data-container, swift, unique-by-type, xcode
- Language: Swift
- Homepage: https://xcessentials.github.io/ByTypeStorage/
- Size: 317 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](LICENSE)
[](https://github.com/XCEssentials/ByTypeStorage/tags)
[](Package.swift)
[](https://github.com/Carthage/Carthage)
[](https://swift.org)
[](Package.swift)
[](https://travis-ci.com/XCEssentials/ByTypeStorage)
# ByTypeStorage
Data container that allows to store exactly one instance of any given type
## How it works
It's Dictionary-like (and Dictionary-based) key-value storage where key is derived from a type provided. Internally keys are just strings generated from a given value type full name (that includes module name, and all parent types in case of nested types). This feature allows to avoid the need of hard-coded string-based keys, improves type-safety, simplifies usage. Obviously, this data container is supposed to be used with custom data types that have some domain-specific semantics in their names and every value associated with this type supposed to be unique within each given storage.