Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuke 12.7 #780

Merged
merged 54 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c7b185b
Update AsyncImageTask documentation
kean Apr 27, 2024
27a252f
Add ImageTask/Event
kean Apr 27, 2024
2dbe607
Add AsyncImageTask/Event
kean Apr 27, 2024
bfbd4dc
Implemenet AsyncImageTask/progress and AsyncImageTask/preview using e…
kean Apr 27, 2024
92b5409
Deprecated AsyncImageTask/previews
kean Apr 27, 2024
238be78
Re-implement ImagePipeline internals using ImageTask.Event
kean Apr 27, 2024
6ad59f7
Implement Async/Await support using ImageTask.Event
kean Apr 27, 2024
102e129
Implement DataTask using ImageTask
kean Apr 27, 2024
baed779
Remove unused onCancel
kean Apr 27, 2024
f730cad
Reuse imageTaskCreated calls
kean Apr 27, 2024
6de9721
Implement loadData reusing most of the loadImage code
kean Apr 27, 2024
a9ad9c0
Move ImageTask (Internal)
kean Apr 27, 2024
e9f09b6
Remove ImageTask.callbackQueue
kean Apr 27, 2024
fded317
Add AsyncStream.pipe()
kean Apr 28, 2024
e22409c
Cleanup loadImage()
kean Apr 28, 2024
c4825c0
Deprecated loadData(with:) that accepts URL
kean Apr 28, 2024
db5595d
Remove unwanted discardableResult
kean Apr 28, 2024
b37eeac
Cleanup ImagePipeline
kean Apr 28, 2024
2c852a6
Remove AsyncStream.pipe and replace with standard makeStream(of:)
kean Apr 28, 2024
7e66e10
Cleanup ImagePipeline
kean Apr 28, 2024
780ec17
Cleanup ImageTask/setState
kean Apr 28, 2024
4a7f2b1
Fix warning in ImageViewPerformanceTests on Swift 6
kean Apr 28, 2024
c05bd18
Add ImageTask/events (experimental)
kean Apr 28, 2024
7546140
Rename ImagePipelineTask to AsyncPipelineTask
kean Apr 28, 2024
a1c5b3a
Rename ImagePipeline+ types
kean Apr 28, 2024
478385d
Remove public events from ImageTask
kean Apr 28, 2024
529d858
Add progress and response async to ImageTask
kean Apr 28, 2024
8098328
Add ImagePipeline/stream
kean Apr 28, 2024
f5fd09c
Start ImageTask eagerly
kean Apr 28, 2024
afc2aad
Add deprecated ImageTask/previews API
kean Apr 28, 2024
439960b
Use the same makeStartedImageTask for loadImage and Async/Await
kean Apr 28, 2024
35e920f
Remove isConfined parameter
kean Apr 28, 2024
fafffec
Move event processing to ImageTask
kean Apr 28, 2024
13f665a
Add testing note
kean Apr 28, 2024
9dbcd79
Extract Event/AsyncContext handling in a separate method
kean Apr 28, 2024
8633837
Fix missing imports
kean Apr 28, 2024
b0ade42
Document cancellation behavior
kean Apr 28, 2024
e4c8579
Improve Async/Await support in ImageTask
kean Apr 30, 2024
c18ba5f
Remove ImageTask/stream
kean Apr 30, 2024
4234f0b
Model events using PassthroughSubject
kean Apr 30, 2024
e140a26
Model ImageTask/events using PassthroughSubject
kean Apr 30, 2024
5ba6166
Add ImageTask/MutableState
kean May 1, 2024
b66ba31
Make the pipeline reference private
kean May 1, 2024
d1c2988
Fix flaky DataLoaderTests
kean May 1, 2024
d4e3f28
ImagePipeline/imageTask(didReceiveEvent:pipeline) delegate method
kean May 2, 2024
b2c3384
Fix strict concurrency warnings when using Atomic
kean May 2, 2024
72fd1dd
Fix concurrency warnings in CoreImageFilter
kean May 2, 2024
8bc6c59
Fix more concurrency warnings
kean May 2, 2024
ffaa854
Update testAsyncImageTaskEvents
kean May 4, 2024
60d06ba
Remove flaky testAsyncEvents (no way to gurantee order)
kean May 4, 2024
09f3620
Use AsyncStream to model ImageTask/events
kean May 4, 2024
acea56d
Fix flaky tests
kean May 4, 2024
cfcf386
Fix testImageTaskEvents
kean May 5, 2024
dbb37e4
Update unit tests to not rely on queue priority
kean May 5, 2024
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ jobs:
# run: Scripts/test.sh -s "Nuke Memory Management Tests" -d "OS=14.4,name=iPhone 12 Pro"
ios-performance-tests:
name: Performance Tests
runs-on: macOS-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer
runs-on: macOS-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Run Tests
run: Scripts/test.sh -s "Nuke Performance Tests" -d "OS=16.4,name=iPhone 14 Pro"
run: Scripts/test.sh -s "Nuke Performance Tests" -d "OS=17.4,name=iPhone 15 Pro"
swift-build:
name: Swift Build (SPM)
runs-on: macOS-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer
runs-on: macOS-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Build
Expand Down
48 changes: 20 additions & 28 deletions Nuke.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

76 changes: 0 additions & 76 deletions Sources/Nuke/AsyncImageTask.swift

This file was deleted.

6 changes: 4 additions & 2 deletions Sources/Nuke/Caching/Cache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ final class Cache<Key: Hashable, Value>: @unchecked Sendable {
self.memoryPressure.resume()

#if os(iOS) || os(tvOS) || os(visionOS)
registerForEnterBackground()
Task {
await registerForEnterBackground()
}
#endif
}

Expand All @@ -68,7 +70,7 @@ final class Cache<Key: Hashable, Value>: @unchecked Sendable {
}

#if os(iOS) || os(tvOS) || os(visionOS)
private func registerForEnterBackground() {
@MainActor private func registerForEnterBackground() {
notificationObserver = NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: nil) { [weak self] _ in
self?.clearCacheOnEnterBackground()
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Nuke/Encoding/ImageEncoders+ImageIO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ extension ImageEncoders {
self.compressionRatio = compressionRatio
}

@Atomic private static var availability = [AssetType: Bool]()
private static let availability = Atomic<[AssetType: Bool]>(value: [:])

/// Returns `true` if the encoding is available for the given format on
/// the current hardware. Some of the most recent formats might not be
/// available so its best to check before using them.
public static func isSupported(type: AssetType) -> Bool {
if let isAvailable = availability[type] {
if let isAvailable = availability.value[type] {
return isAvailable
}
let isAvailable = CGImageDestinationCreateWithData(
NSMutableData() as CFMutableData, type.rawValue as CFString, 1, nil
) != nil
availability[type] = isAvailable
availability.withLock { $0[type] = isAvailable }
return isAvailable
}

Expand Down
10 changes: 6 additions & 4 deletions Sources/Nuke/ImageResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

import Foundation

#if !os(macOS)
import UIKit.UIImage
#else
import AppKit.NSImage
#if canImport(UIKit)
import UIKit
#endif

#if canImport(AppKit)
import AppKit
#endif

/// An image response that contains a fetched image and some metadata.
Expand Down
Loading
Loading