1
Fork 0

Replace URLImage with RemoteImage package to improve list performance

This commit is contained in:
redstrate 2020-06-03 22:52:49 -04:00
parent 2cb480a84b
commit e38c45b353
3 changed files with 33 additions and 21 deletions

View file

@ -13,9 +13,9 @@
03427F5F2488856D00A0073D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 03427F5E2488856D00A0073D /* Assets.xcassets */; }; 03427F5F2488856D00A0073D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 03427F5E2488856D00A0073D /* Assets.xcassets */; };
03427F652488856D00A0073D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 03427F632488856D00A0073D /* LaunchScreen.storyboard */; }; 03427F652488856D00A0073D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 03427F632488856D00A0073D /* LaunchScreen.storyboard */; };
03427F6D248887D200A0073D /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03427F6C248887D200A0073D /* Common.swift */; }; 03427F6D248887D200A0073D /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03427F6C248887D200A0073D /* Common.swift */; };
03427F7024888C6E00A0073D /* URLImage in Frameworks */ = {isa = PBXBuildFile; productRef = 03427F6F24888C6E00A0073D /* URLImage */; };
03BCD7432488947200DA1F27 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7422488947200DA1F27 /* ProfileView.swift */; }; 03BCD7432488947200DA1F27 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7422488947200DA1F27 /* ProfileView.swift */; };
03BCD7452488948200DA1F27 /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7442488948200DA1F27 /* PostView.swift */; }; 03BCD7452488948200DA1F27 /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7442488948200DA1F27 /* PostView.swift */; };
03BCD7482488985A00DA1F27 /* RemoteImage in Frameworks */ = {isa = PBXBuildFile; productRef = 03BCD7472488985A00DA1F27 /* RemoteImage */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@ -36,7 +36,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
03427F7024888C6E00A0073D /* URLImage in Frameworks */, 03BCD7482488985A00DA1F27 /* RemoteImage in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -92,7 +92,7 @@
); );
name = MobileFort; name = MobileFort;
packageProductDependencies = ( packageProductDependencies = (
03427F6F24888C6E00A0073D /* URLImage */, 03BCD7472488985A00DA1F27 /* RemoteImage */,
); );
productName = MobileFort; productName = MobileFort;
productReference = 03427F552488856C00A0073D /* MobileFort.app */; productReference = 03427F552488856C00A0073D /* MobileFort.app */;
@ -122,7 +122,7 @@
); );
mainGroup = 03427F4C2488856C00A0073D; mainGroup = 03427F4C2488856C00A0073D;
packageReferences = ( packageReferences = (
03427F6E24888C6E00A0073D /* XCRemoteSwiftPackageReference "url-image" */, 03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */,
); );
productRefGroup = 03427F562488856C00A0073D /* Products */; productRefGroup = 03427F562488856C00A0073D /* Products */;
projectDirPath = ""; projectDirPath = "";
@ -351,21 +351,21 @@
/* End XCConfigurationList section */ /* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */ /* Begin XCRemoteSwiftPackageReference section */
03427F6E24888C6E00A0073D /* XCRemoteSwiftPackageReference "url-image" */ = { 03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */ = {
isa = XCRemoteSwiftPackageReference; isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/dmytro-anokhin/url-image.git"; repositoryURL = "https://github.com/crelies/RemoteImage";
requirement = { requirement = {
kind = upToNextMajorVersion; kind = upToNextMajorVersion;
minimumVersion = 0.9.15; minimumVersion = 2.0.2;
}; };
}; };
/* End XCRemoteSwiftPackageReference section */ /* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */ /* Begin XCSwiftPackageProductDependency section */
03427F6F24888C6E00A0073D /* URLImage */ = { 03BCD7472488985A00DA1F27 /* RemoteImage */ = {
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;
package = 03427F6E24888C6E00A0073D /* XCRemoteSwiftPackageReference "url-image" */; package = 03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */;
productName = URLImage; productName = RemoteImage;
}; };
/* End XCSwiftPackageProductDependency section */ /* End XCSwiftPackageProductDependency section */
}; };

View file

@ -2,12 +2,21 @@
"object": { "object": {
"pins": [ "pins": [
{ {
"package": "URLImage", "package": "RemoteImage",
"repositoryURL": "https://github.com/dmytro-anokhin/url-image.git", "repositoryURL": "https://github.com/crelies/RemoteImage",
"state": { "state": {
"branch": null, "branch": null,
"revision": "a48feef3ef91f573a5f55779502e07adb19943b8", "revision": "dd92986fbb43c7a204aafabb0b3f550e94d55e70",
"version": "0.9.15" "version": "2.0.2"
}
},
{
"package": "ViewInspector",
"repositoryURL": "https://github.com/nalexn/ViewInspector.git",
"state": {
"branch": null,
"revision": "7d55eb940242512aad2bf28db354d09d5de43893",
"version": "0.3.11"
} }
} }
] ]

View file

@ -1,5 +1,5 @@
import SwiftUI import SwiftUI
import URLImage import RemoteImage
extension String { extension String {
func encodeUrl() -> String? { func encodeUrl() -> String? {
@ -23,12 +23,15 @@ struct PostView: View {
VStack { VStack {
ForEach(post.media) { media in ForEach(post.media) { media in
VStack { VStack {
URLImage(URL(string: media.url.encodeUrl()!)!, RemoteImage(type: .url(URL(string: media.url.encodeUrl()!)!), errorView: { error in
delay: 0.25) { proxy in Text(error.localizedDescription)
proxy.image }, imageView: { image in
.resizable() image
.aspectRatio(contentMode: .fit) .resizable()
} .aspectRatio(contentMode: .fit)
}, loadingView: {
Text("Loading...")
})
} }
} }
} }