Skip to content
Merged
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
8 changes: 4 additions & 4 deletions Sources/AsyncMultiplexImage/AsyncMultiplexImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ open class AsyncMultiplexImageView: UIView {
// MARK: - Properties

public let downloader: any AsyncMultiplexImageDownloader
public let offloadStrategy: any OffloadStrategy
public let offloadStrategy: (any OffloadStrategy)?

private let viewModel: _AsyncMultiplexImageViewModel = .init()

Expand All @@ -53,7 +53,7 @@ open class AsyncMultiplexImageView: UIView {

public init(
downloader: any AsyncMultiplexImageDownloader,
offloadStrategy: any OffloadStrategy = OffloadInvisibleStrategy(),
offloadStrategy: (any OffloadStrategy)? = nil,
clearsContentBeforeDownload: Bool = true
) {

Expand Down Expand Up @@ -106,9 +106,9 @@ open class AsyncMultiplexImageView: UIView {

if state.isInBackground || state.isInDisplay == false {

let offloads = offloadStrategy.offloads(using: state)
let offloads = offloadStrategy?.offloads(using: state)

if offloads {
if let offloads, offloads {
viewModel.cancelCurrentTask()
unloadNetworkImage()
}
Expand Down