Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Add an option to set default processros via FetchImage
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 6, 2021
1 parent abd9f5e commit dc409b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Add progressive previews in memory cache support to `FetchImage`
- Add a property with `ImageContainer` to `FechImage`
- `FetchImage` now supports optional request/publishesr (hanled as failrue)
- Add an option to set default processors via `FetchImage`

## Nuke 10.1.0

Expand Down
7 changes: 7 additions & 0 deletions Sources/UI/FetchImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public final class FetchImage: ObservableObject, Identifiable {
public var onCompletion: ((_ result: Result<ImageResponse, ImagePipeline.Error>) -> Void)?

public var pipeline: ImagePipeline = .shared

/// Image processors to be applied unless the processors are provided in the request.
public var processors: [ImageProcessing] = []

private var task: ImageTask?

// publisher support
Expand Down Expand Up @@ -100,6 +104,9 @@ public final class FetchImage: ObservableObject, Identifiable {
if request.priority != priority {
request.priority = priority
}
if !processors.isEmpty && request.processors.isEmpty {
request.processors = processors
}

isLoading = true
progress = Progress(completed: 0, total: 0)
Expand Down

0 comments on commit dc409b6

Please sign in to comment.