Skip to content

Commit c2d4c11

Browse files
Updated Nuke dependency
1 parent 10bbb0f commit c2d4c11

File tree

12 files changed

+65
-26
lines changed

12 files changed

+65
-26
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44
# Upcoming
55

66
### 🔄 Changed
7+
- Updated Nuke dependency to 11.3.0 for SPM
8+
- Removed NukeUI dependency for SPM (now part of Nuke)
79

810
# [4.22.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.22.0)
911
_September 27, 2022_

DemoAppSwiftUI/CustomChannelHeader.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public struct CustomChannelHeader: ToolbarContent {
1818
@Binding var isNewChatShown: Bool
1919
@Binding var logoutAlertShown: Bool
2020

21+
@MainActor
2122
public var body: some ToolbarContent {
2223
ToolbarItem(placement: .principal) {
2324
Text(title)
@@ -41,7 +42,7 @@ public struct CustomChannelHeader: ToolbarContent {
4142
Button {
4243
logoutAlertShown = true
4344
} label: {
44-
LazyImage(source: currentUserController.currentUser?.imageURL)
45+
LazyImage(url: currentUserController.currentUser?.imageURL)
4546
.onDisappear(.cancel)
4647
.clipShape(Circle())
4748
.frame(

DemoAppSwiftUI/LoginView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct DemoUserView: View {
5757

5858
var body: some View {
5959
HStack {
60-
LazyImage(source: user.avatarURL)
60+
LazyImage(url: user.avatarURL)
6161
.onDisappear(.cancel)
6262
.clipShape(Circle())
6363
.frame(

Package.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ let package = Package(
1818
],
1919
dependencies: [
2020
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.22.0"),
21-
.package(url: "https://github.com/kean/Nuke.git", from: "10.0.0"),
22-
.package(url: "https://github.com/kean/NukeUI.git", from: "0.7.0")
21+
.package(url: "https://github.com/kean/Nuke.git", .exact("11.3.0"))
2322
],
2423
targets: [
2524
.target(
2625
name: "StreamChatSwiftUI",
27-
dependencies: [.product(name: "StreamChat", package: "stream-chat-swift"), "Nuke", "NukeUI"],
26+
dependencies: [.product(name: "StreamChat", package: "stream-chat-swift"), "Nuke", .product(name: "NukeUI", package: "Nuke")],
2827
exclude: ["README.md", "Info.plist", "Generated/L10n_template.stencil"],
2928
resources: [.process("Resources")]
3029
)

Sources/StreamChatSwiftUI/ChatChannel/MessageList/GiphyAttachmentView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct LazyGiphyView: View {
9797
let width: CGFloat
9898

9999
var body: some View {
100-
LazyImage(source: source) { state in
100+
LazyImage(imageURL: source) { state in
101101
if let imageContainer = state.imageContainer {
102102
Image(imageContainer)
103103
} else if state.error != nil {

Sources/StreamChatSwiftUI/ChatChannel/MessageList/LinkAttachmentView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public struct LinkAttachmentView: View {
8282
VStack(alignment: .leading, spacing: padding) {
8383
if !imageHidden {
8484
ZStack {
85-
LazyImage(source: linkAttachment.previewURL ?? linkAttachment.originalURL)
85+
LazyImage(imageURL: linkAttachment.previewURL ?? linkAttachment.originalURL)
8686
.onDisappear(.cancel)
8787
.processors([ImageProcessors.Resize(width: width)])
8888
.priority(.high)

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageAvatarView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public struct MessageAvatarView: View {
3737
preferredSize: size
3838
)
3939

40-
LazyImage(source: adjustedURL)
40+
LazyImage(imageURL: adjustedURL)
4141
.onDisappear(.cancel)
4242
.priority(.normal)
4343
.clipShape(Circle())

Sources/StreamChatSwiftUI/ChatChannel/MessageList/QuotedMessageView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public struct QuotedMessageView<Factory: ViewFactory>: View {
110110
)
111111
} else if !quotedMessage.linkAttachments.isEmpty {
112112
LazyImage(
113-
source: quotedMessage.linkAttachments[0].previewURL ?? quotedMessage.linkAttachments[0]
113+
imageURL: quotedMessage.linkAttachments[0].previewURL ?? quotedMessage.linkAttachments[0]
114114
.originalURL
115115
)
116116
.onDisappear(.cancel)

Sources/StreamChatSwiftUI/Utils/Common/NukeImageProcessor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ extension ImageProcessors {
6868
return size
6969
}
7070

71-
private let sizeProvider: () -> CGSize
71+
private let sizeProvider: @Sendable() -> CGSize
7272

7373
/// Initializes the processor with size providing closure.
7474
/// - Parameter sizeProvider: Closure to obtain size after the image is loaded.
75-
public init(sizeProvider: @escaping () -> CGSize) {
75+
public init(sizeProvider: @escaping @Sendable() -> CGSize) {
7676
self.sizeProvider = sizeProvider
7777
}
7878

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Copyright © 2022 Stream.io Inc. All rights reserved.
3+
//
4+
5+
import Nuke
6+
import NukeUI
7+
import SwiftUI
8+
9+
extension LazyImage {
10+
11+
public init(imageURL: URL?) where Content == NukeUI.Image {
12+
#if COCOAPODS
13+
self.init(source: imageURL)
14+
#else
15+
self.init(url: imageURL, resizingMode: .aspectFill)
16+
#endif
17+
}
18+
19+
public init(imageURL: URL?, @ViewBuilder content: @escaping (LazyImageState) -> Content) {
20+
#if COCOAPODS
21+
self.init(source: imageURL, content: content)
22+
#else
23+
self.init(url: imageURL, content: content)
24+
#endif
25+
}
26+
}

0 commit comments

Comments
 (0)