Skip to content

Fix warnings #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Sources/AsyncImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ public protocol AsyncImage {
extension AsyncImage {
public var isEdited: Bool {
get {
return objc_getAssociatedObject(self, &AsyncImageKeys.isEdited) as? Bool ?? false
return objc_getAssociatedObject(self, AsyncImageKeys.isEdited) as? Bool ?? false
}
set {
objc_setAssociatedObject(self, &AsyncImageKeys.isEdited, newValue, .OBJC_ASSOCIATION_RETAIN)
objc_setAssociatedObject(self, AsyncImageKeys.isEdited, newValue, .OBJC_ASSOCIATION_RETAIN)
}
}

public var editedImage: UIImage? {
get {
return objc_getAssociatedObject(self, &AsyncImageKeys.editedImage) as? UIImage ?? nil
return objc_getAssociatedObject(self, AsyncImageKeys.editedImage) as? UIImage ?? nil
}
set {
objc_setAssociatedObject(self, &AsyncImageKeys.editedImage, newValue, .OBJC_ASSOCIATION_RETAIN)
objc_setAssociatedObject(self, AsyncImageKeys.editedImage, newValue, .OBJC_ASSOCIATION_RETAIN)
}
}
}

private enum AsyncImageKeys {
static var isEdited = "isEdited"
static var editedImage = "editedImage"
static let isEdited = malloc(1)!
static let editedImage = malloc(1)!
}
6 changes: 3 additions & 3 deletions Sources/Extensions/PHAsset+AsyncImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ extension PHAsset: AsyncImage {
*/
public var requests: [PHImageRequestID] {
get {
return objc_getAssociatedObject(self, &Keys.requests) as? [PHImageRequestID] ?? []
return objc_getAssociatedObject(self, Keys.requests) as? [PHImageRequestID] ?? []
}
set {
objc_setAssociatedObject(self, &Keys.requests, newValue, .OBJC_ASSOCIATION_RETAIN)
objc_setAssociatedObject(self, Keys.requests, newValue, .OBJC_ASSOCIATION_RETAIN)
}
}

Expand Down Expand Up @@ -72,6 +72,6 @@ extension PHAsset: AsyncImage {
}

private enum Keys {
static var requests = "requests"
static let requests = malloc(1)!
}
}