Swiftpack.co - quangnghiadev/SafeDictionary as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by quangnghiadev.
quangnghiadev/SafeDictionary 1.0.0
SafeDictionary for safe access dictionary value when working with multi thread
⭐️ 0
🕓 3 years ago
iOS
.package(url: "https://github.com/quangnghiadev/SafeDictionary.git", from: "1.0.0")

Build Status SPM compatible Swift Xcode MIT

SafeDictionary

SafeDictionary for safe access dictionary value when working with multi thread

Installation

Swift Package Manager

You can use The Swift Package Manager to install AsyncOperation by adding https://github.com/quangnghiadev/SafeDictionary.git to Swift Package of your XCode project

Usage

Using this class for safe access dictionary value when working with multi thread

let safeDictionary = SafeDictionary<String, Int>(queueLabel: "queue.name")

/// Get value from key
let id = safeDictionary["id"]
// or
let id = safeDictionary.getValue(key: "id")

/// Update value for key
safeDictionary.updateValue(2, forKey: "id")
// or
safeDictionary["id"] = 2

/// Remove value with key
safeDictionary.removeValue(forKey: "id")

/// Get all keys
let keys = safeDictionary.keys

/// Remove all element with keeping capacity ability
safeDictionary.removeAll()
safeDictionary.removeAll(keepingCapacity: true)

License

  • Safe Dictionary is released under the MIT license. See LICENSE for more information.

GitHub

link
Stars: 0
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Alpha
3 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics