mirror of
https://github.com/kean/Nuke.git
synced 2024-11-28 03:34:09 +03:00
Compare commits
13 Commits
fc840ac536
...
bd8a7700e5
Author | SHA1 | Date | |
---|---|---|---|
|
bd8a7700e5 | ||
|
4878846229 | ||
|
de39ec1f0d | ||
|
a4413f67dd | ||
|
9c025c6090 | ||
|
072f73277a | ||
|
81e8412feb | ||
|
b6209897cf | ||
|
1d748d4eac | ||
|
840b743058 | ||
|
ef56fdd004 | ||
|
639832849c | ||
|
0e953da391 |
73
.github/workflows/ci.yml
vendored
73
.github/workflows/ci.yml
vendored
@ -10,22 +10,22 @@ on:
|
||||
|
||||
jobs:
|
||||
ios-latest:
|
||||
name: Unit Tests (iOS 17.4, Xcode 15.3)
|
||||
runs-on: macOS-14
|
||||
name: Unit Tests (iOS 18.0, Xcode 16.0)
|
||||
runs-on: macOS-15
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
run: |
|
||||
.scripts/test.sh -s "Nuke" -d "OS=17.4,name=iPhone 15 Pro"
|
||||
.scripts/test.sh -s "NukeUI" -d "OS=17.4,name=iPhone 15 Pro"
|
||||
.scripts/test.sh -s "NukeExtensions" -d "OS=17.4,name=iPhone 15 Pro"
|
||||
.scripts/test.sh -s "Nuke" -d "OS=18.0,name=iPhone 16 Pro"
|
||||
.scripts/test.sh -s "NukeUI" -d "OS=18.0,name=iPhone 16 Pro"
|
||||
.scripts/test.sh -s "NukeExtensions" -d "OS=18.0,name=iPhone 16 Pro"
|
||||
macos-latest:
|
||||
name: Unit Tests (macOS, Xcode 15.3)
|
||||
runs-on: macOS-14
|
||||
name: Unit Tests (macOS, Xcode 16.0)
|
||||
runs-on: macOS-15
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
@ -34,17 +34,17 @@ jobs:
|
||||
.scripts/test.sh -s "NukeUI" -d "platform=macOS"
|
||||
.scripts/test.sh -s "NukeExtensions" -d "platform=macOS"
|
||||
tvos-latest:
|
||||
name: Unit Tests (tvOS 17.4, Xcode 15.3)
|
||||
runs-on: macOS-14
|
||||
name: Unit Tests (tvOS 18.0, Xcode 16.0)
|
||||
runs-on: macOS-15
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
run: |
|
||||
.scripts/test.sh -s "Nuke" -d "OS=17.4,name=Apple TV"
|
||||
.scripts/test.sh -s "NukeUI" -d "OS=17.4,name=Apple TV"
|
||||
.scripts/test.sh -s "NukeExtensions" -d "OS=17.4,name=Apple TV"
|
||||
.scripts/test.sh -s "Nuke" -d "OS=18.0,name=Apple TV"
|
||||
.scripts/test.sh -s "NukeUI" -d "OS=18.0,name=Apple TV"
|
||||
.scripts/test.sh -s "NukeExtensions" -d "OS=18.0,name=Apple TV"
|
||||
# There is a problem with watchOS runners where they often fail to launch on CI
|
||||
#
|
||||
# watchos-latest:
|
||||
@ -59,27 +59,30 @@ jobs:
|
||||
# .scripts/test.sh -s "Nuke" -d "OS=9.1,name=Apple Watch Series 8 (45mm)"
|
||||
# .scripts/test.sh -s "NukeUI" -d "OS=9.1,name=Apple Watch Series 8 (45mm)"
|
||||
# .scripts/test.sh -s "Nuke Extensions" -d "OS=9.1,name=Apple Watch Series 8 (45mm)"
|
||||
ios-xcode-14-3-1:
|
||||
name: Unit Tests (iOS 17.0, Xcode 15.0)
|
||||
runs-on: macOS-13
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
run: |
|
||||
.scripts/test.sh -s "Nuke" -d "OS=17.0,name=iPhone 15 Pro"
|
||||
.scripts/test.sh -s "NukeUI" -d "OS=17.0,name=iPhone 15 Pro"
|
||||
.scripts/test.sh -s "NukeExtensions" -d "OS=17.0,name=iPhone 15 Pro"
|
||||
|
||||
# Nuke 13.0 supports only the latest version of Xcode (16).
|
||||
#
|
||||
# ios-xcode-14-3-1:
|
||||
# name: Unit Tests (iOS 17.0, Xcode 15.0)
|
||||
# runs-on: macOS-13
|
||||
# env:
|
||||
# DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - name: Run Tests
|
||||
# run: |
|
||||
# .scripts/test.sh -s "Nuke" -d "OS=17.0,name=iPhone 15 Pro"
|
||||
# .scripts/test.sh -s "NukeUI" -d "OS=17.0,name=iPhone 15 Pro"
|
||||
# .scripts/test.sh -s "NukeExtensions" -d "OS=17.0,name=iPhone 15 Pro"
|
||||
ios-thread-safety:
|
||||
name: Thread Safety Tests (TSan Enabled)
|
||||
runs-on: macOS-14
|
||||
runs-on: macOS-15
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
run: .scripts/test.sh -s "Nuke Thread Safety Tests" -d "OS=17.4,name=iPhone 15 Pro"
|
||||
run: .scripts/test.sh -s "Nuke Thread Safety Tests" -d "OS=18.0,name=iPhone 16 Pro"
|
||||
# ios-memory-management-tests:
|
||||
# name: Memory Management Tests
|
||||
# runs-on: macOS-13
|
||||
@ -91,18 +94,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-14
|
||||
runs-on: macOS-15
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
run: .scripts/test.sh -s "Nuke Performance Tests" -d "OS=17.4,name=iPhone 15 Pro"
|
||||
run: .scripts/test.sh -s "Nuke Performance Tests" -d "OS=18.0,name=iPhone 16 Pro"
|
||||
swift-build:
|
||||
name: Swift Build (SPM)
|
||||
runs-on: macOS-14
|
||||
runs-on: macOS-15
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build
|
||||
|
@ -1,13 +1,13 @@
|
||||
// swift-tools-version:5.9
|
||||
// swift-tools-version:6.0
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "Nuke",
|
||||
platforms: [
|
||||
.iOS(.v13),
|
||||
.tvOS(.v13),
|
||||
.macOS(.v10_15),
|
||||
.watchOS(.v6),
|
||||
.iOS(.v14),
|
||||
.tvOS(.v14),
|
||||
.macOS(.v11),
|
||||
.watchOS(.v7),
|
||||
.visionOS(.v1),
|
||||
],
|
||||
products: [
|
||||
|
22
README.md
22
README.md
@ -18,19 +18,29 @@ The framework is lean and compiles in under 2 seconds[¹](#footnote-1). It has a
|
||||
|
||||
## Sponsors
|
||||
|
||||
[**Lapse**](https://www.lapse.com): friends *not followers*.
|
||||
|
||||
<a href="https://www.lapse.com"><img src="https://github.com/user-attachments/assets/28bb4f4b-affc-4580-879d-5aeef633b80c" height="140px" alt="Lapse Logo"></a>
|
||||
|
||||
Nuke is also supported by:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="center">
|
||||
<a href="https://proxyman.io"><img src="https://kean.blog/images/logos/proxyman.png" height="40px" alt="Proxyman Logo"></a>
|
||||
<td valign="center" align="center">
|
||||
<a href="https://proxyman.io">
|
||||
<img src="https://kean.blog/images/logos/proxyman.png" height="50px" alt="Proxyman Logo">
|
||||
<p>Proxyman</p>
|
||||
</a>
|
||||
</td>
|
||||
<td valign="center">
|
||||
<a href="https://www.namiml.com#gh-light-mode-only"><img src="https://kean.blog/images/logos/nami-light.png#gh-light-mode-only" height="40px" alt="Nami Logo"></a><a href="https://www.namiml.com#gh-dark-mode-only"><img src="https://kean.blog/images/logos/nami-dark.png#gh-dark-mode-only" height="40px" alt="Nami Logo"></a>
|
||||
<td valign="center" align="center">
|
||||
<a href="https://backspace.travel">
|
||||
<img src="https://avatars.githubusercontent.com/u/175125884?s=200&v=4" height="50px", alt="Backspace Travel"/>
|
||||
<p>Backspace Travel</p>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
> [Support](https://github.com/sponsors/kean) Nuke on GitHub Sponsors.
|
||||
|
||||
## Installation
|
||||
|
||||
Nuke supports [Swift Package Manager](https://www.swift.org/package-manager/), which is the recommended option. If that doesn't work for you, you can use binary frameworks attached to the [releases](https://github.com/kean/Nuke/releases).
|
||||
|
@ -28,7 +28,7 @@ import AppKit
|
||||
/// )
|
||||
/// let image = try await pipeline.image(for: request)
|
||||
/// ```
|
||||
public struct ImageRequest: CustomStringConvertible, Sendable, ExpressibleByStringLiteral {
|
||||
public struct ImageRequest: CustomStringConvertible, @unchecked Sendable, ExpressibleByStringLiteral {
|
||||
// MARK: Options
|
||||
|
||||
/// The relative priority of the request. The priority affects the order in
|
||||
@ -437,7 +437,7 @@ public struct ImageRequest: CustomStringConvertible, Sendable, ExpressibleByStri
|
||||
extension ImageRequest {
|
||||
/// Just like many Swift built-in types, ``ImageRequest`` uses CoW approach to
|
||||
/// avoid memberwise retain/releases when ``ImageRequest`` is passed around.
|
||||
private final class Container: @unchecked Sendable {
|
||||
private final class Container {
|
||||
// It's beneficial to put resource before priority and options because
|
||||
// of the resource size/stride of 9/16. Priority (1 byte) and Options
|
||||
// (2 bytes) slot just right in the remaining space.
|
||||
|
@ -30,14 +30,14 @@ public final class ImageTask: Hashable {
|
||||
/// The priority of the task. The priority can be updated dynamically even
|
||||
/// for a task that is already running.
|
||||
public nonisolated var priority: ImageRequest.Priority {
|
||||
get { nonisolatedState.withLock { $0.priority } }
|
||||
get { nonisolatedState.withLock(\.priority) }
|
||||
set { setPriority(newValue) }
|
||||
}
|
||||
|
||||
/// Returns the current download progress. Returns zeros before the download
|
||||
/// is started and the expected size of the resource is known.
|
||||
public nonisolated var currentProgress: Progress {
|
||||
nonisolatedState.withLock { $0.progress }
|
||||
nonisolatedState.withLock(\.progress)
|
||||
}
|
||||
|
||||
/// The download progress.
|
||||
@ -74,7 +74,7 @@ public final class ImageTask: Hashable {
|
||||
|
||||
/// Returns `true` if the task cancellation is initiated.
|
||||
public nonisolated var isCancelling: Bool {
|
||||
nonisolatedState.withLock { $0.isCancelling }
|
||||
nonisolatedState.withLock(\.isCancelling)
|
||||
}
|
||||
|
||||
// MARK: - Async/Await
|
||||
|
@ -6,7 +6,7 @@ import Foundation
|
||||
|
||||
extension ImagePipeline {
|
||||
/// Represents all possible image pipeline errors.
|
||||
public enum Error: Swift.Error, CustomStringConvertible, @unchecked Sendable {
|
||||
public enum Error: Swift.Error, CustomStringConvertible, Sendable {
|
||||
/// Returned if data not cached and ``ImageRequest/Options-swift.struct/returnCacheDataDontLoad`` option is specified.
|
||||
case dataMissingInCache
|
||||
/// Data loader failed to load image data with a wrapped error.
|
||||
|
@ -18,7 +18,7 @@ class ImagePipelinePerfomanceTests: XCTestCase {
|
||||
var finished: Int = 0
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
for request in requests {
|
||||
pipeline.loadImage(with: request, queue: callbackQueue, progress: nil) { _ in
|
||||
pipeline.loadImage(with: request, progress: nil) { _ in
|
||||
finished += 1
|
||||
if finished == requests.count {
|
||||
semaphore.signal()
|
||||
|
Loading…
Reference in New Issue
Block a user