Contents

b9swift/AssociatedObject

Objective-C associated value wrapper in Swift.

Installation

You can use either Swift Package Manager or manual importing to add this package to your project.

你也可以使用 gitee 镜像

Usage

You can define extended properties like below. All kinds of Swift types are also supported, not only Objective-C objects.

import B9AssociatedObject

private let fooAssociation = AssociatedObject<String>()
extension SomeObject {
    var foo: String? {
        get { fooAssociation[self] }
        set { fooAssociation[self] = newValue }
    }
}

Package Metadata

Repository: b9swift/AssociatedObject

Stars: 7

Forks: 0

Open issues: 0

Default branch: main

Primary language: swift

License: MIT

README: README.md