Skip to content

Commit

Permalink
Deprecate ImageProgressive default and create default init
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Jul 1, 2022
1 parent 6895d6f commit b2b7b90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/General/KF.swift
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ extension KF.Builder {
/// progressive JPEG data and display it in a progressive way.
/// - Parameter progressive: The progressive settings which is used while loading.
/// - Returns: A `KF.Builder` with changes applied.
public func progressiveJPEG(_ progressive: ImageProgressive? = .default) -> Self {
public func progressiveJPEG(_ progressive: ImageProgressive? = .init()) -> Self {
options.progressiveJPEG = progressive
return self
}
Expand Down
12 changes: 12 additions & 0 deletions Sources/Image/ImageProgressive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public struct ImageProgressive {

/// A default `ImageProgressive` could be used across. It blurs the progressive loading with the fastest
/// scan enabled and scan interval as 0.
@available(*, deprecated, message: "Getting a default `ImageProgressive` is deprecated due to its syntax symatic is not clear. Use `ImageProgressive.init` instead.", renamed: "init()")
public static let `default` = ImageProgressive(
isBlur: true,
isFastestScan: true,
Expand All @@ -64,6 +65,17 @@ public struct ImageProgressive {
/// image retrieving is not happening from a view extension method), the returned `UpdatingStrategy` is ignored.
public let onImageUpdated = Delegate<KFCrossPlatformImage, UpdatingStrategy>()

/// Creates an `ImageProgressive` value with default sets. It blurs the progressive loading with the fastest
/// scan enabled and scan interval as 0.
public init() {
self.init(isBlur: true, isFastestScan: true, scanInterval: 0)
}

/// Creates an `ImageProgressive` value the given values.
/// - Parameters:
/// - isBlur: Whether to enable blur effect processing.
/// - isFastestScan: Whether to enable the fastest scan.
/// - scanInterval: Minimum time interval for each scan.
public init(isBlur: Bool,
isFastestScan: Bool,
scanInterval: TimeInterval
Expand Down

0 comments on commit b2b7b90

Please sign in to comment.