Skip to content

Commit

Permalink
Add CachedAsyncImage for images
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Jul 6, 2023
1 parent 900d45c commit 27dd1a3
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 21 deletions.
36 changes: 23 additions & 13 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ let productionDependencies: [PackageDescription.Package.Dependency] = { [
.package(url: "https://github.com/oversizedev/OversizeComponents.git", .upToNextMajor(from: "1.2.0")),
.package(url: "https://github.com/oversizedev/OversizeResources.git", .upToNextMajor(from: "1.3.0")),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
// .package(name: "OversizeNetwork", path: "../OversizeNetwork"),
// .package(url: "https://github.com/apple/swift-openapi-runtime", .upToNextMinor(from: "0.1.0")),
// .package(url: "https://github.com/apple/swift-openapi-urlsession", .upToNextMinor(from: "0.1.0")),
// .package(url: "https://github.com/oversizedev/OversizeNetwork.git", .upToNextMajor(from: "0.1.0"))
.package(url: "https://github.com/lorenzofiamingo/swiftui-cached-async-image.git", .upToNextMajor(from: "2.1.1")),
/*
.package(name: "OversizeNetwork", path: "../OversizeNetwork"),
.package(url: "https://github.com/apple/swift-openapi-runtime", .upToNextMinor(from: "0.1.0")),
.package(url: "https://github.com/apple/swift-openapi-urlsession", .upToNextMinor(from: "0.1.0")),
.package(url: "https://github.com/oversizedev/OversizeNetwork.git", .upToNextMajor(from: "0.1.0"))
*/
] }()

let developmentDependencies: [PackageDescription.Package.Dependency] = { [
Expand All @@ -25,9 +28,12 @@ let developmentDependencies: [PackageDescription.Package.Dependency] = { [
.package(name: "OversizeComponents", path: "../OversizeComponents"),
.package(name: "OversizeResources", path: "../OversizeResources"),
.package(name: "OversizeNetwork", path: "../OversizeNetwork"),
// .package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
// .package(url: "https://github.com/apple/swift-openapi-runtime", .upToNextMinor(from: "0.1.0")),
// .package(url: "https://github.com/apple/swift-openapi-urlsession", .upToNextMinor(from: "0.1.0")),
.package(url: "https://github.com/lorenzofiamingo/swiftui-cached-async-image.git", .upToNextMajor(from: "2.1.1")),
/*
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
.package(url: "https://github.com/apple/swift-openapi-runtime", .upToNextMinor(from: "0.1.0")),
.package(url: "https://github.com/apple/swift-openapi-urlsession", .upToNextMinor(from: "0.1.0")),
*/
] }()

let package = Package(
Expand Down Expand Up @@ -63,6 +69,7 @@ let package = Package(
.product(name: "OversizeResources", package: "OversizeResources"),
.product(name: "OversizeNotificationService", package: "OversizeServices"),
.product(name: "Factory", package: "Factory"),
.product(name: "CachedAsyncImage", package: "swiftui-cached-async-image"),
]
),
.target(
Expand All @@ -72,12 +79,15 @@ let package = Package(
.product(name: "Factory", package: "Factory"),
.product(name: "OversizeUI", package: "OversizeUI"),
.product(name: "OversizeServices", package: "OversizeServices"),
// .product(name: "OversizeNetwork", package: "OversizeNetwork"),
// .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
// .product(
// name: "OpenAPIURLSession",
// package: "swift-openapi-urlsession"
// ),
.product(name: "CachedAsyncImage", package: "swiftui-cached-async-image"),
/*
.product(name: "OversizeNetwork", package: "OversizeNetwork"),
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
.product(
name: "OpenAPIURLSession",
package: "swift-openapi-urlsession"
),
*/
]
),
.target(
Expand Down
3 changes: 2 additions & 1 deletion Sources/OversizeAdsKit/AdView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// AdView.swift
//

import CachedAsyncImage
import OversizeKit
import OversizeServices
import OversizeUI
Expand Down Expand Up @@ -36,7 +37,7 @@ public struct AdView: View {

var premiumBanner: some View {
HStack(spacing: .zero) {
AsyncImage(url: URL(string: "\(Info.links?.company.cdnString ?? "")/assets/apps/\(viewModel.appAd?.path ?? "")/icon.png"), content: {
CachedAsyncImage(url: URL(string: "\(Info.links?.company.cdnString ?? "")/assets/apps/\(viewModel.appAd?.path ?? "")/icon.png"), content: {
$0
.resizable()
.frame(width: 64, height: 64)
Expand Down
9 changes: 5 additions & 4 deletions Sources/OversizeKit/SettingsKit/Views/About/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// AboutView.swift
//

import CachedAsyncImage
import OversizeComponents
import OversizeLocalizable
import OversizeResources
Expand Down Expand Up @@ -203,7 +204,7 @@ import SwiftUI
} label: {
VStack(spacing: .xSmall) {
let imageUrl = "\(Info.links?.company.cdnString ?? "")/assets/apps/\(app.path ?? "")/icon.png"
AsyncImage(url: URL(string: imageUrl), content: {
CachedAsyncImage(url: URL(string: imageUrl), content: {
$0
.resizable()
.frame(width: 74, height: 74)
Expand Down Expand Up @@ -373,7 +374,7 @@ import SwiftUI
HStack {
VStack(alignment: .center) {
ZStack(alignment: .top) {
AsyncImage(url: URL(string: "https://cdn.oversize.design/assets/illustrations/scenes/about-layer3.png"), scale: scale) {
CachedAsyncImage(url: URL(string: "https://cdn.oversize.design/assets/illustrations/scenes/about-layer3.png"), scale: scale) {
$0
.resizable()
.scaledToFit()
Expand All @@ -387,7 +388,7 @@ import SwiftUI
}
.offset(y: -offset * 0.1)

AsyncImage(url: URL(string: "https://cdn.oversize.design/assets/illustrations/scenes/about-layer2.png"), scale: scale) {
CachedAsyncImage(url: URL(string: "https://cdn.oversize.design/assets/illustrations/scenes/about-layer2.png"), scale: scale) {
$0
.resizable()
.scaledToFit()
Expand All @@ -403,7 +404,7 @@ import SwiftUI
}
}

AsyncImage(url: URL(string: "https://cdn.oversize.design/assets/illustrations/scenes/about-layer1.png"), scale: scale) {
CachedAsyncImage(url: URL(string: "https://cdn.oversize.design/assets/illustrations/scenes/about-layer1.png"), scale: scale) {
$0
.resizable()
.scaledToFit()
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeKit/SettingsKit/Views/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ import SwiftUI
.buttonStyle(.row)
.sheet(isPresented: $isShowFeedback) {
FeedbackView()
.presentationDetents([.height(600)])
.presentationDetents([.height(560)])
.presentationContentInteraction(.resizes)
.presentationCompactAdaptation(.sheet)
.scrollDisabled(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// StoreFeatureDetailView.swift
//

import CachedAsyncImage
import OversizeComponents
import OversizeCore
import OversizeResources
Expand Down Expand Up @@ -107,7 +108,7 @@ struct StoreFeatureDetailView: View {
func iconFetureItem(_ feature: PlistConfiguration.Store.StoreFeature, geometry: GeometryProxy) -> some View {
VStack(spacing: .xxxSmall) {
if let IllustrationURLPath = feature.illustrationURL {
AsyncImage(url: URL(string: IllustrationURLPath)) { image in
CachedAsyncImage(url: URL(string: IllustrationURLPath)) { image in
image
.resizable()
.scaledToFill()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// StoreFeaturesLargeView.swift
//

import CachedAsyncImage
import OversizeComponents
import OversizeResources
import OversizeServices
Expand Down Expand Up @@ -73,7 +74,7 @@ struct StoreFeaturesLargeView: View {
func fetureItem(_ feature: PlistConfiguration.Store.StoreFeature) -> some View {
VStack(spacing: .zero) {
if let IllustrationURLPath = feature.illustrationURL {
AsyncImage(url: URL(string: IllustrationURLPath)) { image in
CachedAsyncImage(url: URL(string: IllustrationURLPath)) { image in
image
.resizable()
.scaledToFill()
Expand Down

0 comments on commit 27dd1a3

Please sign in to comment.