Summary
KingfisherWrapper.setImage(...) currently passes previousCancellationToken and setCancellationToken as standalone parameters in addition to TaskPropertyAccessor.
These token-related parameters belong to the same task lifecycle concern as:
setTaskIdentifier
getTaskIdentifier
setTask
The current shape works, but it creates parameter sprawl and makes the helper signature harder to read.
Proposed Direction
Fold cancellation-token access into TaskPropertyAccessor so the helper receives a single lifecycle accessor instead of splitting task state across:
taskAccessor
previousCancellationToken
setCancellationToken
Possible shape:
- add token getter/setter accessors to
TaskPropertyAccessor
- let the helper cancel the previous token and store the new token through that accessor
Scope
This is a readability / maintainability cleanup only.
It should not change behavior.
Non-Goals
- do not change the current stale-disk-cache semantics
- do not refactor unrelated associated-object patterns in this issue
- do not change public API surface
Affected Files
Likely at least:
Sources/Extensions/HasImageComponent+Kingfisher.swift
Sources/Extensions/ImageView+Kingfisher.swift
Sources/Extensions/NSTextAttachment+Kingfisher.swift
Sources/Extensions/CPListItem+Kingfisher.swift
Sources/Extensions/UIButton+Kingfisher.swift
Sources/Extensions/NSButton+Kingfisher.swift
Acceptance
- helper signature becomes simpler
- token lifecycle stays encapsulated with other task lifecycle accessors
- no behavior change
- existing stale cache tests continue to pass
Summary
KingfisherWrapper.setImage(...)currently passespreviousCancellationTokenandsetCancellationTokenas standalone parameters in addition toTaskPropertyAccessor.These token-related parameters belong to the same task lifecycle concern as:
setTaskIdentifiergetTaskIdentifiersetTaskThe current shape works, but it creates parameter sprawl and makes the helper signature harder to read.
Proposed Direction
Fold cancellation-token access into
TaskPropertyAccessorso the helper receives a single lifecycle accessor instead of splitting task state across:taskAccessorpreviousCancellationTokensetCancellationTokenPossible shape:
TaskPropertyAccessorScope
This is a readability / maintainability cleanup only.
It should not change behavior.
Non-Goals
Affected Files
Likely at least:
Sources/Extensions/HasImageComponent+Kingfisher.swiftSources/Extensions/ImageView+Kingfisher.swiftSources/Extensions/NSTextAttachment+Kingfisher.swiftSources/Extensions/CPListItem+Kingfisher.swiftSources/Extensions/UIButton+Kingfisher.swiftSources/Extensions/NSButton+Kingfisher.swiftAcceptance