Swift Package Index


A weak-to-strong map table


  • The latest stable release is 1.2.0. Released 3 months ago.
  • The last commit to master was 3 months ago.

Swift Version Compatibility

  • 1.2.0 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 1.2.0 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

WeakMapTable

Swift CocoaPods Build Status CodeCov

A weak-to-strong map table. It is inspired by NSMapTable but guarantees thread safety and deals better with weak references. NSMapTable.weakToStrongObjects() doesn't free the value object when the key object is deallocated but WeakMapTable does.

APIs

public func value(forKey key: Key) -> Value?
public func value(forKey key: Key, default: @autoclosure () -> Value) -> Value
public func forceCastedValue<T>(forKey key: Key, default: @autoclosure () -> T) -> T
public func setValue(_ value: Value?, forKey key: Key)

Installation

Podfile

pod 'WeakMapTable'

License

WeakMapTable is under MIT license. See the LICENSE file for more info.