Skip to content

Commit

Permalink
Remove deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jul 28, 2024
1 parent 786bebc commit 6168ab1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
30 changes: 3 additions & 27 deletions Sources/Nuke/Caching/DataCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ public final class DataCache: DataCaching, @unchecked Sendable {
/// The time interval between cache sweeps. The default value is 1 hour.
public var sweepInterval: TimeInterval = 3600

// Deprecated in Nuke 12.2
@available(*, deprecated, message: "It's not recommended to use compression with the popular image formats that already compress the data")
public var isCompressionEnabled: Bool {
get { _isCompressionEnabled }
set { _isCompressionEnabled = newValue }
}
var _isCompressionEnabled = false

// Staging

private let lock = NSLock()
Expand Down Expand Up @@ -143,7 +135,7 @@ public final class DataCache: DataCaching, @unchecked Sendable {
guard let url = url(for: key) else {
return nil
}
return try? decompressed(Data(contentsOf: url))
return try? Data(contentsOf: url)
}

/// Returns `true` if the cache contains the data for the given key.
Expand Down Expand Up @@ -322,33 +314,17 @@ public final class DataCache: DataCaching, @unchecked Sendable {
switch change.type {
case let .add(data):
do {
try compressed(data).write(to: url)
try data.write(to: url)
} catch let error as NSError {
guard error.code == CocoaError.fileNoSuchFile.rawValue && error.domain == CocoaError.errorDomain else { return }
try? FileManager.default.createDirectory(at: self.path, withIntermediateDirectories: true, attributes: nil)
try? compressed(data).write(to: url) // re-create a directory and try again
try? data.write(to: url) // re-create a directory and try again
}
case .remove:
try? FileManager.default.removeItem(at: url)
}
}

// MARK: Compression

private func compressed(_ data: Data) throws -> Data {
guard _isCompressionEnabled else {
return data
}
return try (data as NSData).compressed(using: .lzfse) as Data
}

private func decompressed(_ data: Data) throws -> Data {
guard _isCompressionEnabled else {
return data
}
return try (data as NSData).decompressed(using: .lzfse) as Data
}

// MARK: Sweep

/// Synchronously performs a cache sweep and removes the least recently items
Expand Down
4 changes: 0 additions & 4 deletions Sources/Nuke/Pipeline/ImagePipeline+Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ extension ImagePipeline {
/// Data loading queue. Default maximum concurrent task count is 6.
public var dataLoadingQueue = OperationQueue(maxConcurrentCount: 6)

// Deprecated in Nuke 12.6
@available(*, deprecated, message: "The pipeline now performs cache lookup on the internal queue, reducing the amount of context switching")
public var dataCachingQueue = OperationQueue(maxConcurrentCount: 2)

/// Image decoding queue. Default maximum concurrent task count is 1.
public var imageDecodingQueue = OperationQueue(maxConcurrentCount: 1)

Expand Down
4 changes: 0 additions & 4 deletions Sources/Nuke/Processing/ImageProcessors+Resize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ extension ImageProcessors {
private let crop: Bool
private let upscale: Bool

// Deprecated in Nuke 12.0
@available(*, deprecated, message: "Renamed to `ImageProcessingOptions.ContentMode")
public typealias ContentMode = ImageProcessingOptions.ContentMode

/// Initializes the processor with the given size.
///
/// - parameters:
Expand Down

0 comments on commit 6168ab1

Please sign in to comment.