Skip to content

Commit

Permalink
Replace async image loading to Kingfisher library
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Nov 13, 2023
1 parent 25e16a1 commit fc4629c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 49 deletions.
25 changes: 0 additions & 25 deletions UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2953,8 +2953,6 @@
D3E1D00D2990DA0400C68F00 /* Hodler in Frameworks */ = {isa = PBXBuildFile; productRef = D3E1D00C2990DA0400C68F00 /* Hodler */; };
D3E323C82AE7B8E400F73914 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = D3E323C72AE7B8E400F73914 /* KeychainAccess */; };
D3E323CA2AE7B8F400F73914 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = D3E323C92AE7B8F400F73914 /* KeychainAccess */; };
D3E6756E2AA9A21300F2BF60 /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = D3E6756D2AA9A21300F2BF60 /* SDWebImageSwiftUI */; };
D3E675702AA9A24900F2BF60 /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = D3E6756F2AA9A24900F2BF60 /* SDWebImageSwiftUI */; };
D3F7D6412A94D53500477BB1 /* BaseTransactionsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35B106BD8E4DBD67B7700 /* BaseTransactionsService.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -4525,7 +4523,6 @@
D3604E9C28F03DC00066C366 /* FeeRateKit in Frameworks */,
D3C187E2290FD00E00FE1900 /* ComponentKit in Frameworks */,
D339A93F29126D2A00B895BE /* HsCryptoKit in Frameworks */,
D3E675702AA9A24900F2BF60 /* SDWebImageSwiftUI in Frameworks */,
D3604E9628F03DC00066C366 /* ModuleKit in Frameworks */,
D3C187E6290FD00E00FE1900 /* LanguageKit in Frameworks */,
);
Expand All @@ -4544,7 +4541,6 @@
D3604E6928F02DF30066C366 /* BitcoinCashKit in Frameworks */,
D3993DC228F42992008720FB /* UnstoppableDomainsResolution in Frameworks */,
D3604E8528F03CDC0066C366 /* BinanceChainKit in Frameworks */,
D3E6756E2AA9A21300F2BF60 /* SDWebImageSwiftUI in Frameworks */,
D3C187BA2907CFAB00FE1900 /* Checkpoints in Frameworks */,
6BDA29AD29D6F384003847ED /* ECashKit in Frameworks */,
D3604E4D28F02AB40066C366 /* NftKit in Frameworks */,
Expand Down Expand Up @@ -8597,7 +8593,6 @@
D3AF5A9229FFD87500C1399E /* RxSwift */,
D023D2642A24B9DC004F65B0 /* TronKit */,
D0EC34DC2A4450D200BB308B /* HCaptcha */,
D3E6756F2AA9A24900F2BF60 /* SDWebImageSwiftUI */,
D3E323C72AE7B8E400F73914 /* KeychainAccess */,
6B55E33C2AF26D7A00616B60 /* Starscream */,
);
Expand Down Expand Up @@ -8659,7 +8654,6 @@
D3AF5A8C29FFD85800C1399E /* RxSwift */,
D023D2622A249E59004F65B0 /* TronKit */,
D0EC34DA2A4450B100BB308B /* HCaptcha */,
D3E6756D2AA9A21300F2BF60 /* SDWebImageSwiftUI */,
D3E323C92AE7B8F400F73914 /* KeychainAccess */,
6B55E33A2AF26D6400616B60 /* Starscream */,
);
Expand Down Expand Up @@ -8830,7 +8824,6 @@
D023D2612A249E59004F65B0 /* XCRemoteSwiftPackageReference "TronKit.Swift" */,
D0EC34D92A4450B100BB308B /* XCRemoteSwiftPackageReference "HCaptcha-ios-sdk" */,
6B55461F2A6E73190054B524 /* XCRemoteSwiftPackageReference "UIExtensions.Swift" */,
D3E6756C2AA9A21300F2BF60 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */,
D3E323C62AE7B8E400F73914 /* XCRemoteSwiftPackageReference "KeychainAccess" */,
6B55E3392AF26D6400616B60 /* XCRemoteSwiftPackageReference "Starscream" */,
);
Expand Down Expand Up @@ -12780,14 +12773,6 @@
minimumVersion = 4.0.0;
};
};
D3E6756C2AA9A21300F2BF60 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SDWebImage/SDWebImageSwiftUI.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down Expand Up @@ -13221,16 +13206,6 @@
package = D3E323C62AE7B8E400F73914 /* XCRemoteSwiftPackageReference "KeychainAccess" */;
productName = KeychainAccess;
};
D3E6756D2AA9A21300F2BF60 /* SDWebImageSwiftUI */ = {
isa = XCSwiftPackageProductDependency;
package = D3E6756C2AA9A21300F2BF60 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */;
productName = SDWebImageSwiftUI;
};
D3E6756F2AA9A24900F2BF60 /* SDWebImageSwiftUI */ = {
isa = XCSwiftPackageProductDependency;
package = D3E6756C2AA9A21300F2BF60 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */;
productName = SDWebImageSwiftUI;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = D3285F3A20BD158E00644076 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SDWebImageSwiftUI
import Kingfisher
import SwiftUI

struct BtcBlockchainSettingsView: View {
Expand All @@ -21,11 +21,12 @@ struct BtcBlockchainSettingsView: View {
viewModel.selectedRestoreMode = restoreMode.restoreMode
}) {
switch restoreMode.icon {
case .local(let name): Image(name)
case .remote(let url): WebImage(url: URL(string: url))
.resizable()
.scaledToFit()
.frame(width: .iconSize32, height: .iconSize32)
case let .local(name):
Image(name)
case let .remote(url):
KFImage.url(URL(string: url))
.resizable()
.frame(width: .iconSize32, height: .iconSize32)
}

VStack(spacing: 1) {
Expand Down Expand Up @@ -59,9 +60,8 @@ struct BtcBlockchainSettingsView: View {
.navigationBarTitleDisplayMode(.large)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
WebImage(url: URL(string: viewModel.iconUrl))
KFImage.url(URL(string: viewModel.iconUrl))
.resizable()
.scaledToFit()
.frame(width: .iconSize24, height: .iconSize24)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SDWebImageSwiftUI
import Kingfisher
import SwiftUI

struct CoinMarketsView: View {
Expand Down Expand Up @@ -78,10 +78,11 @@ struct CoinMarketsView: View {
}

@ViewBuilder private func listItemContent(viewItem: CoinMarketsViewModel.ViewItem) -> some View {
WebImage(url: viewItem.marketImageUrl.flatMap { URL(string: $0) })
KFImage.url(viewItem.marketImageUrl.flatMap { URL(string: $0) })
.resizable()
.placeholder { RoundedRectangle(cornerRadius: .cornerRadius8, style: .continuous).fill(Color.themeGray) }
.scaledToFit()
.placeholder {
RoundedRectangle(cornerRadius: .cornerRadius8, style: .continuous).fill(Color.themeSteel20)
}
.clipShape(RoundedRectangle(cornerRadius: .cornerRadius8, style: .continuous))
.frame(width: .iconSize32, height: .iconSize32)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SDWebImageSwiftUI
import Kingfisher
import SwiftUI

struct CoinOverviewView: View {
Expand Down Expand Up @@ -27,10 +27,11 @@ struct CoinOverviewView: View {
ScrollView {
VStack(spacing: 0) {
HStack(spacing: .margin16) {
WebImage(url: URL(string: coin.imageUrl))
.placeholder(Image("placeholder_circle_32"))
KFImage.url(URL(string: coin.imageUrl))
.resizable()
.scaledToFit()
.placeholder {
Circle().fill(Color.themeSteel20)
}
.frame(width: .iconSize32, height: .iconSize32)

Text(coin.name).themeBody()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SDWebImageSwiftUI
import Kingfisher
import SwiftUI
import ThemeKit

Expand Down Expand Up @@ -66,9 +66,8 @@ struct AppearanceView: View {
ClickableRow(action: {
viewModel.conversionToken = token
}) {
WebImage(url: URL(string: token.coin.imageUrl))
KFImage.url(URL(string: token.coin.imageUrl))
.resizable()
.scaledToFit()
.frame(width: .iconSize32, height: .iconSize32)

Text(token.coin.code).themeBody()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import SDWebImageSwiftUI
import SwiftUI
import ThemeKit

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import SDWebImageSwiftUI
import SwiftUI
import ThemeKit

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Kingfisher
import MarketKit
import SDWebImageSwiftUI
import SwiftUI

struct BlockchainSettingsView: View {
Expand Down Expand Up @@ -53,9 +53,8 @@ struct BlockchainSettingsView: View {
let value: String

var body: some View {
WebImage(url: URL(string: blockchain.type.imageUrl))
KFImage.url(URL(string: blockchain.type.imageUrl))
.resizable()
.scaledToFit()
.frame(width: .iconSize32, height: .iconSize32)

VStack(spacing: 1) {
Expand Down

0 comments on commit fc4629c

Please sign in to comment.