Skip to content
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

Rework ImageRequest #245

Merged
merged 6 commits into from
May 20, 2019
Merged

Rework ImageRequest #245

merged 6 commits into from
May 20, 2019

Conversation

kean
Copy link
Owner

@kean kean commented May 19, 2019

Changes

  • Move advanced options into separate ImageRequestOptions struct
  • Remove the entire zoo of processing API, leaves a single one - processors: [ImageProcessing]
  • Initializers now accept every single option that request might have

Examples

Settings processor:

let request = ImageRequest(url: URL(string: "http://..."), processors: [
    ImageProcessor.Resize(size: CGSize(width: 44, height: 44))
])

Setting priority:

let request = ImageRequest(url: URL(string: "http://..."), priority: .high)

Setting everything:

let request = ImageRequest(
    url: URL(string: "http://..."),
    processors: [
        ImageProcessor.Resize(size: CGSize(width: 44, height: 44), crop: true),
        ImageProcessor.RoundedCorners(radius: 16)
    ],
    priority: .high,
    options: .init(
        memoryCacheOptions: .init(
            isReadAllowed: false,
            isWriteAllowed: false
        ),
        cacheKey: "1",
        loadKey: "2",
        userInfo: "hello"
    )
)

@kean kean merged commit 60e0263 into nuke8 May 20, 2019
@kean kean deleted the rework-image-request branch May 20, 2019 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant