Skip to content

Commit

Permalink
Caching sponsor images
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Aug 23, 2024
1 parent b8cee48 commit 225fe7b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
9 changes: 9 additions & 0 deletions SwiftIslandApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@
2A7F12892A69CB2C007C28EA /* XCRemoteSwiftPackageReference "Defaults" */,
2AFA65E82A9E9371004A13F8 /* XCRemoteSwiftPackageReference "SwiftLint" */,
2A77AD8C2C05272B00610250 /* XCRemoteSwiftPackageReference "AckGen" */,
B374A95D2C7959430050955F /* XCRemoteSwiftPackageReference "swiftui-cached-async-image" */,
);
productRefGroup = 2AEDC4942A4A030F00CD0180 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1410,6 +1411,14 @@
minimumVersion = 0.52.4;
};
};
B374A95D2C7959430050955F /* XCRemoteSwiftPackageReference "swiftui-cached-async-image" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/lorenzofiamingo/swiftui-cached-async-image";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.1.1;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@
"version" : "0.55.1"
}
},
{
"identity" : "swiftui-cached-async-image",
"kind" : "remoteSourceControl",
"location" : "https://github.com/lorenzofiamingo/swiftui-cached-async-image",
"state" : {
"revision" : "467a3d17479887943ab917a379e62bbaff60ac8a",
"version" : "2.1.1"
}
},
{
"identity" : "swiftytexttable",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

import SwiftUI
import SwiftIslandDataLogic
import CachedAsyncImage

extension URLCache {
static let imageCache = URLCache(memoryCapacity: 512_000_000, diskCapacity: 10_000_000_000)
}

struct ConferenceBoxSponsors: View {
@EnvironmentObject private var appDataModel: AppDataModel
Expand All @@ -27,7 +32,7 @@ struct ConferenceBoxSponsors: View {
currentSponsor = sponsor
} label: {
VStack {
AsyncImage(url: sponsor.image) { image in
CachedAsyncImage(url: sponsor.image) { image in
image.resizable().aspectRatio(1, contentMode: .fit)
} placeholder: {
Rectangle()
Expand All @@ -47,7 +52,7 @@ struct ConferenceBoxSponsors: View {
currentSponsor = sponsor
} label: {
VStack {
AsyncImage(url: sponsor.image) { image in
CachedAsyncImage(url: sponsor.image) { image in
image.resizable().aspectRatio(contentMode: .fit)
} placeholder: {
Rectangle()
Expand Down

0 comments on commit 225fe7b

Please sign in to comment.