Skip to content

Commit 6ad6a5c

Browse files
Removed Nuke from the demo app (#386)
1 parent e83d8ac commit 6ad6a5c

File tree

6 files changed

+38
-51
lines changed

6 files changed

+38
-51
lines changed

DemoAppSwiftUI/CustomChannelHeader.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

5-
import NukeUI
65
import StreamChat
76
import StreamChatSwiftUI
87
import SwiftUI
@@ -42,13 +41,7 @@ public struct CustomChannelHeader: ToolbarContent {
4241
Button {
4342
logoutAlertShown = true
4443
} label: {
45-
LazyImage(url: currentUserController.currentUser?.imageURL)
46-
.onDisappear(.cancel)
47-
.clipShape(Circle())
48-
.frame(
49-
width: 30,
50-
height: 30
51-
)
44+
StreamLazyImage(url: currentUserController.currentUser?.imageURL)
5245
}
5346
}
5447
}

DemoAppSwiftUI/LoginView.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

5-
import NukeUI
65
import StreamChatSwiftUI
76
import SwiftUI
87

@@ -57,13 +56,10 @@ struct DemoUserView: View {
5756

5857
var body: some View {
5958
HStack {
60-
LazyImage(url: user.avatarURL)
61-
.onDisappear(.cancel)
62-
.clipShape(Circle())
63-
.frame(
64-
width: imageSize,
65-
height: imageSize
66-
)
59+
StreamLazyImage(
60+
url: user.avatarURL,
61+
size: CGSize(width: imageSize, height: imageSize)
62+
)
6763

6864
VStack(alignment: .leading, spacing: 4) {
6965
Text(user.name)

Sources/StreamChatSwiftUI/Utils/LazyImageExtensions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import SwiftUI
66

77
extension LazyImage {
88

9-
public init(imageURL: URL?) where Content == NukeImage {
9+
init(imageURL: URL?) where Content == NukeImage {
1010
let imageCDN = InjectedValues[\.utils].imageCDN
1111
guard let imageURL = imageURL else {
1212
#if COCOAPODS
@@ -25,7 +25,7 @@ extension LazyImage {
2525
#endif
2626
}
2727

28-
public init(imageURL: URL?, @ViewBuilder content: @escaping (LazyImageState) -> Content) {
28+
init(imageURL: URL?, @ViewBuilder content: @escaping (LazyImageState) -> Content) {
2929
let imageCDN = InjectedValues[\.utils].imageCDN
3030
guard let imageURL = imageURL else {
3131
#if COCOAPODS
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
3+
//
4+
5+
import SwiftUI
6+
7+
public struct StreamLazyImage: View {
8+
9+
var url: URL?
10+
var size: CGSize
11+
12+
public init(url: URL?, size: CGSize = CGSize(width: 30, height: 30)) {
13+
self.url = url
14+
self.size = size
15+
}
16+
17+
public var body: some View {
18+
LazyImage(url: url)
19+
.onDisappear(.cancel)
20+
.clipShape(Circle())
21+
.frame(
22+
width: size.width,
23+
height: size.height
24+
)
25+
}
26+
}

StreamChatSwiftUI.xcodeproj/project.pbxproj

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@
151151
84289BEB2807239B00282ABE /* MediaAttachmentsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84289BEA2807239B00282ABE /* MediaAttachmentsViewModel.swift */; };
152152
84289BED2807244E00282ABE /* FileAttachmentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84289BEC2807244E00282ABE /* FileAttachmentsView.swift */; };
153153
84289BEF2807246E00282ABE /* FileAttachmentsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84289BEE2807246E00282ABE /* FileAttachmentsViewModel.swift */; };
154-
842ADEA428EADC6600F2BE36 /* Nuke in Frameworks */ = {isa = PBXBuildFile; productRef = 842ADEA328EADC6600F2BE36 /* Nuke */; };
155-
842ADEA628EADC6600F2BE36 /* NukeUI in Frameworks */ = {isa = PBXBuildFile; productRef = 842ADEA528EADC6600F2BE36 /* NukeUI */; };
156154
842ADEA928EB018C00F2BE36 /* LazyImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842ADEA828EB018C00F2BE36 /* LazyImageExtensions.swift */; };
157155
842F036D288E93BF00496D49 /* ChatMessage_AdjustedText_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842F036C288E93BF00496D49 /* ChatMessage_AdjustedText_Tests.swift */; };
158156
842F0BB8276B3518002C400C /* QuotedMessageView_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842F0BB7276B3518002C400C /* QuotedMessageView_Tests.swift */; };
@@ -424,6 +422,7 @@
424422
84E95A77284A486600699FD3 /* StreamChat in Frameworks */ = {isa = PBXBuildFile; productRef = 84E95A76284A486600699FD3 /* StreamChat */; };
425423
84E95A7D284A491000699FD3 /* StreamChatTestTools in Frameworks */ = {isa = PBXBuildFile; productRef = 84E95A7C284A491000699FD3 /* StreamChatTestTools */; };
426424
84EDBC37274FE5CD0057218D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 84EDBC36274FE5CD0057218D /* Localizable.strings */; };
425+
84F130C12AEAA957006E7B52 /* StreamLazyImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F130C02AEAA957006E7B52 /* StreamLazyImage.swift */; };
427426
84F2908A276B90610045472D /* GalleryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F29089276B90610045472D /* GalleryView.swift */; };
428427
84F2908C276B91700045472D /* ZoomableScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2908B276B91700045472D /* ZoomableScrollView.swift */; };
429428
84F2908E276B92A40045472D /* GalleryHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2908D276B92A40045472D /* GalleryHeaderView.swift */; };
@@ -931,6 +930,7 @@
931930
84E6EC24279AEE9F0017207B /* StreamChatTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamChatTestCase.swift; sourceTree = "<group>"; };
932931
84E6EC26279B0C930017207B /* ReactionsUsersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactionsUsersView.swift; sourceTree = "<group>"; };
933932
84EDBC36274FE5CD0057218D /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
933+
84F130C02AEAA957006E7B52 /* StreamLazyImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamLazyImage.swift; sourceTree = "<group>"; };
934934
84F29089276B90610045472D /* GalleryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryView.swift; sourceTree = "<group>"; };
935935
84F2908B276B91700045472D /* ZoomableScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZoomableScrollView.swift; sourceTree = "<group>"; };
936936
84F2908D276B92A40045472D /* GalleryHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryHeaderView.swift; sourceTree = "<group>"; };
@@ -982,9 +982,7 @@
982982
isa = PBXFrameworksBuildPhase;
983983
buildActionMask = 2147483647;
984984
files = (
985-
842ADEA628EADC6600F2BE36 /* NukeUI in Frameworks */,
986985
84E95A77284A486600699FD3 /* StreamChat in Frameworks */,
987-
842ADEA428EADC6600F2BE36 /* Nuke in Frameworks */,
988986
);
989987
runOnlyForDeploymentPostprocessing = 0;
990988
};
@@ -1654,6 +1652,7 @@
16541652
841B64C92775BBC10016FF3B /* Errors.swift */,
16551653
847CEFED27C38ABE00606257 /* MessageCachingUtils.swift */,
16561654
84733EC527FDBF82006926E0 /* NetworkReachability.swift */,
1655+
84F130C02AEAA957006E7B52 /* StreamLazyImage.swift */,
16571656
842ADEA828EB018C00F2BE36 /* LazyImageExtensions.swift */,
16581657
8465FD382746A95600AF091E /* Common */,
16591658
);
@@ -2064,8 +2063,6 @@
20642063
name = StreamChatSwiftUI;
20652064
packageProductDependencies = (
20662065
84E95A76284A486600699FD3 /* StreamChat */,
2067-
842ADEA328EADC6600F2BE36 /* Nuke */,
2068-
842ADEA528EADC6600F2BE36 /* NukeUI */,
20692066
);
20702067
productName = StreamChatSwiftUI;
20712068
productReference = 8465FBB52746873A00AF091E /* StreamChatSwiftUI.framework */;
@@ -2160,7 +2157,6 @@
21602157
8400A346282C06F90067D3A0 /* XCRemoteSwiftPackageReference "OHHTTPStubs" */,
21612158
A3571601283E9D9F0014E3B0 /* XCRemoteSwiftPackageReference "swifter" */,
21622159
84E95A75284A486600699FD3 /* XCRemoteSwiftPackageReference "stream-chat-swift" */,
2163-
842ADEA228EADC6600F2BE36 /* XCRemoteSwiftPackageReference "Nuke" */,
21642160
82543C7B2AD41B0400D5F6CD /* XCRemoteSwiftPackageReference "stream-chat-swift-test-helpers" */,
21652161
);
21662162
productRefGroup = 8465FBB62746873A00AF091E /* Products */;
@@ -2372,6 +2368,7 @@
23722368
82D64BE02AD7E5B700C5C79E /* LazyImage.swift in Sources */,
23732369
82D64C052AD7E5B700C5C79E /* Deprecated.swift in Sources */,
23742370
84DEC8EC27611CAE00172876 /* SendInChannelView.swift in Sources */,
2371+
84F130C12AEAA957006E7B52 /* StreamLazyImage.swift in Sources */,
23752372
82D64BD12AD7E5B700C5C79E /* Image.swift in Sources */,
23762373
82D64BD52AD7E5B700C5C79E /* AnimatedFrame.swift in Sources */,
23772374
8465FD9F2746A95700AF091E /* ChatChannelExtensions.swift in Sources */,
@@ -3240,14 +3237,6 @@
32403237
minimumVersion = 9.0.0;
32413238
};
32423239
};
3243-
842ADEA228EADC6600F2BE36 /* XCRemoteSwiftPackageReference "Nuke" */ = {
3244-
isa = XCRemoteSwiftPackageReference;
3245-
repositoryURL = "https://github.com/kean/Nuke.git";
3246-
requirement = {
3247-
kind = exactVersion;
3248-
version = 11.3.1;
3249-
};
3250-
};
32513240
8465FCB227468A8D00AF091E /* XCRemoteSwiftPackageReference "stream-chat-swift" */ = {
32523241
isa = XCRemoteSwiftPackageReference;
32533242
repositoryURL = "https://github.com/GetStream/stream-chat-swift.git";
@@ -3298,16 +3287,6 @@
32983287
package = 8400A346282C06F90067D3A0 /* XCRemoteSwiftPackageReference "OHHTTPStubs" */;
32993288
productName = OHHTTPStubs;
33003289
};
3301-
842ADEA328EADC6600F2BE36 /* Nuke */ = {
3302-
isa = XCSwiftPackageProductDependency;
3303-
package = 842ADEA228EADC6600F2BE36 /* XCRemoteSwiftPackageReference "Nuke" */;
3304-
productName = Nuke;
3305-
};
3306-
842ADEA528EADC6600F2BE36 /* NukeUI */ = {
3307-
isa = XCSwiftPackageProductDependency;
3308-
package = 842ADEA228EADC6600F2BE36 /* XCRemoteSwiftPackageReference "Nuke" */;
3309-
productName = NukeUI;
3310-
};
33113290
8465FCE32746954F00AF091E /* StreamChat */ = {
33123291
isa = XCSwiftPackageProductDependency;
33133292
package = 8465FCB227468A8D00AF091E /* XCRemoteSwiftPackageReference "stream-chat-swift" */;

StreamChatSwiftUITestsApp/CustomChannelHeader.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

5-
import NukeUI
65
import StreamChat
76
import StreamChatSwiftUI
87
import SwiftUI
@@ -28,13 +27,7 @@ public struct CustomChannelHeader: ToolbarContent {
2827
Button {
2928
logoutAlertShown = true
3029
} label: {
31-
LazyImage(url: currentUserController.currentUser?.imageURL)
32-
.onDisappear(.cancel)
33-
.clipShape(Circle())
34-
.frame(
35-
width: 30,
36-
height: 30
37-
)
30+
StreamLazyImage(url: currentUserController.currentUser?.imageURL)
3831
}
3932
.accessibilityAddTraits(.isButton)
4033
.accessibilityIdentifier("LogoutButton")

0 commit comments

Comments
 (0)