B9AssociatedObject

1.0.1

Objective-C associated value wrapper in Swift.
b9swift/AssociatedObject

What's New

2022

2022-12-11T09:45:29Z
  • Just a little documentation update.

B9AssociatedObject

Swift Version Swift Package Manager Build Status gitee 镜像

Objective-C associated value wrapper for convenient use in Swift. It is primarily used to add attributes to existing types through extensions.

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 }
    }
}

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Dec 07 2024 17:21:38 GMT-1000 (Hawaii-Aleutian Standard Time)