diff --git a/Sources/Nuke/Internal/Atomic.swift b/Sources/Nuke/Internal/Atomic.swift index 5a5d39744..43055ce35 100644 --- a/Sources/Nuke/Internal/Atomic.swift +++ b/Sources/Nuke/Internal/Atomic.swift @@ -4,7 +4,7 @@ import Foundation -final class Atomic: @unchecked Sendable { +final class Atomic: @unchecked Sendable { private var _value: T private let lock: os_unfair_lock_t diff --git a/Sources/Nuke/Processing/ImageProcessors+CoreImage.swift b/Sources/Nuke/Processing/ImageProcessors+CoreImage.swift index 71cd73ea3..27d725064 100644 --- a/Sources/Nuke/Processing/ImageProcessors+CoreImage.swift +++ b/Sources/Nuke/Processing/ImageProcessors+CoreImage.swift @@ -78,7 +78,12 @@ extension ImageProcessors { /// A default context shared between all Core Image filters. The context /// has `.priorityRequestLow` option set to `true`. - public static var context = CIContext(options: [.priorityRequestLow: true]) + public static var context: CIContext { + get { _context.value } + set { _context.value = newValue } + } + + private static let _context = Atomic(value: CIContext(options: [.priorityRequestLow: true])) static func applyFilter(named name: String, parameters: [String: Any] = [:], to image: PlatformImage) throws -> PlatformImage { guard let filter = CIFilter(name: name, parameters: parameters) else {