一个同时保持键和值唯一性的字典。
当您需要使用 BijectiveDictionary 时:
BijectiveDictionary 通过六个类实现了排序、可变性和线程安全。
OPCBijectiveDictionary
OPCMutableBijectiveDictionary
OPCOrderedBijectiveDictionary
OPCMutableOrderedBijectiveDictionary
OPCThreadSafeMutableBijectiveDictionary
OPCThreadSafeMutableOrderedBijectiveDictionary
OPCMutableBijectiveDictionary *dict = [OPCMutableBijectiveDictionary dictionary];
// Add a new key-value pair.
dict[@"key"] = @"value";
// Retrieve the value for @"key".
NSString *value = dict[@"key"];
// Retrieve the key for @"value".
NSString *key = dict.inverse[@"value"];
最低 iOS 目标:5.0
BijectiveDictionary 通过 CocoaPods 提供。要安装,请将以下行添加到您的 Podfile
中,然后运行 pod install
。
pod 'BijectiveDictionary'
BijectiveDictionary 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE
文件。