Commit 2fd5d3b0 by Daniel Dahan

made AssociatedObject internal for new submodule setup

parent 0846f0c2
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
public struct AssociatedObject { internal struct AssociatedObject {
/** /**
Gets the Obj-C reference for the instance object within the UIView extension. Gets the Obj-C reference for the instance object within the UIView extension.
- Parameter base: Base object. - Parameter base: Base object.
...@@ -31,7 +31,7 @@ public struct AssociatedObject { ...@@ -31,7 +31,7 @@ public struct AssociatedObject {
- Parameter initializer: Object initializer. - Parameter initializer: Object initializer.
- Returns: The associated reference for the initializer object. - Returns: The associated reference for the initializer object.
*/ */
public static func get<T: Any>(base: Any, key: UnsafePointer<UInt8>, initializer: () -> T) -> T { static func get<T: Any>(base: Any, key: UnsafePointer<UInt8>, initializer: () -> T) -> T {
if let v = objc_getAssociatedObject(base, key) as? T { if let v = objc_getAssociatedObject(base, key) as? T {
return v return v
} }
...@@ -48,7 +48,7 @@ public struct AssociatedObject { ...@@ -48,7 +48,7 @@ public struct AssociatedObject {
- Parameter value: The object instance to set for the associated object. - Parameter value: The object instance to set for the associated object.
- Returns: The associated reference for the initializer object. - Returns: The associated reference for the initializer object.
*/ */
public static func set<T: Any>(base: Any, key: UnsafePointer<UInt8>, value: T) { static func set<T: Any>(base: Any, key: UnsafePointer<UInt8>, value: T) {
objc_setAssociatedObject(base, key, value, .OBJC_ASSOCIATION_RETAIN) objc_setAssociatedObject(base, key, value, .OBJC_ASSOCIATION_RETAIN)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment