Switch to URLImage for better macOS support
This commit is contained in:
parent
bf6db01562
commit
83a265f34a
4 changed files with 88 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import RemoteImage
|
import URLImage
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
func encodeUrl() -> String? {
|
func encodeUrl() -> String? {
|
||||||
|
@ -13,15 +13,11 @@ struct PostView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
RemoteImage(type: .url(URL(string: post.post.avatarUrl.encodeUrl()!)!), errorView: { error in
|
URLImage(url: URL(string: post.post.avatarUrl.encodeUrl()!)!) { image in
|
||||||
Text(error.localizedDescription)
|
|
||||||
}, imageView: { image in
|
|
||||||
image
|
image
|
||||||
.resizable()
|
.resizable()
|
||||||
.aspectRatio(contentMode: .fit)
|
.aspectRatio(contentMode: .fit)
|
||||||
}, loadingView: {
|
}.frame(width: 50.0, height: 50.0).padding(.leading)
|
||||||
Text("Loading...")
|
|
||||||
}).frame(width: 50.0, height: 50.0).padding(.leading)
|
|
||||||
|
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
if post.post.isReblogged() {
|
if post.post.isReblogged() {
|
||||||
|
@ -40,15 +36,10 @@ struct PostView: View {
|
||||||
ForEach(post.post.media) { media in
|
ForEach(post.post.media) { media in
|
||||||
if !media.url.isEmpty {
|
if !media.url.isEmpty {
|
||||||
VStack {
|
VStack {
|
||||||
RemoteImage(type: .url(URL(string: media.url.encodeUrl()!)!), errorView: { error in
|
URLImage(url: URL(string: media.url.encodeUrl()!)!) { image in
|
||||||
Text(error.localizedDescription)
|
|
||||||
}, imageView: { image in
|
|
||||||
image
|
image
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
.aspectRatio(contentMode: .fit)
|
||||||
}, loadingView: {
|
}
|
||||||
Text("Loading...")
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,60 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string></string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleName</key>
|
||||||
<string>6.0</string>
|
<string>$(PRODUCT_NAME)</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>$(PRODUCT_NAME)</string>
|
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0</string>
|
<string>1</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<string>1</string>
|
<true/>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>UIApplicationSceneManifest</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<dict>
|
||||||
<key>NSMainStoryboardFile</key>
|
<key>UIApplicationSupportsMultipleScenes</key>
|
||||||
<string>Main</string>
|
<false/>
|
||||||
<key>NSPrincipalClass</key>
|
<key>UISceneConfigurations</key>
|
||||||
<string>NSApplication</string>
|
<dict>
|
||||||
</dict>
|
<key>UIWindowSceneSessionRoleApplication</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>UISceneConfigurationName</key>
|
||||||
|
<string>Default Configuration</string>
|
||||||
|
<key>UISceneDelegateClassName</key>
|
||||||
|
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>UILaunchStoryboardName</key>
|
||||||
|
<string>LaunchScreen</string>
|
||||||
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
|
<array>
|
||||||
|
<string>armv7</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
03B2BA7025654F0500483FE3 /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03427F6C248887D200A0073D /* Common.swift */; };
|
03B2BA7025654F0500483FE3 /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03427F6C248887D200A0073D /* Common.swift */; };
|
||||||
03B2BA7125654F0500483FE3 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7422488947200DA1F27 /* ProfileView.swift */; };
|
03B2BA7125654F0500483FE3 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7422488947200DA1F27 /* ProfileView.swift */; };
|
||||||
03B2BA7225654F0500483FE3 /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7442488948200DA1F27 /* PostView.swift */; };
|
03B2BA7225654F0500483FE3 /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7442488948200DA1F27 /* PostView.swift */; };
|
||||||
03B2BA7925654F4E00483FE3 /* RemoteImage in Frameworks */ = {isa = PBXBuildFile; productRef = 03B2BA7825654F4E00483FE3 /* RemoteImage */; };
|
|
||||||
03B2BA85256550FA00483FE3 /* AttributedText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B2BA84256550FA00483FE3 /* AttributedText.swift */; };
|
03B2BA85256550FA00483FE3 /* AttributedText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B2BA84256550FA00483FE3 /* AttributedText.swift */; };
|
||||||
03B2BA9F2565555500483FE3 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B2BA9E2565555500483FE3 /* MainView.swift */; };
|
03B2BA9F2565555500483FE3 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B2BA9E2565555500483FE3 /* MainView.swift */; };
|
||||||
|
03B2BAA4256556C800483FE3 /* URLImage in Frameworks */ = {isa = PBXBuildFile; productRef = 03B2BAA3256556C800483FE3 /* URLImage */; };
|
||||||
|
03B2BAA8256556D100483FE3 /* URLImage in Frameworks */ = {isa = PBXBuildFile; productRef = 03B2BAA7256556D100483FE3 /* 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 */; };
|
|
||||||
03BCD74A2489322500DA1F27 /* AttributedText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7492489322500DA1F27 /* AttributedText.swift */; };
|
03BCD74A2489322500DA1F27 /* AttributedText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7492489322500DA1F27 /* AttributedText.swift */; };
|
||||||
03BCD74D2489365600DA1F27 /* WebView in Frameworks */ = {isa = PBXBuildFile; productRef = 03BCD74C2489365600DA1F27 /* WebView */; };
|
03BCD74D2489365600DA1F27 /* WebView in Frameworks */ = {isa = PBXBuildFile; productRef = 03BCD74C2489365600DA1F27 /* WebView */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
03BCD74D2489365600DA1F27 /* WebView in Frameworks */,
|
03BCD74D2489365600DA1F27 /* WebView in Frameworks */,
|
||||||
03BCD7482488985A00DA1F27 /* RemoteImage in Frameworks */,
|
03B2BAA8256556D100483FE3 /* URLImage in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
03B2BA7925654F4E00483FE3 /* RemoteImage in Frameworks */,
|
03B2BAA4256556C800483FE3 /* URLImage in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -165,8 +165,8 @@
|
||||||
);
|
);
|
||||||
name = "MobileFort (iOS)";
|
name = "MobileFort (iOS)";
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
03BCD7472488985A00DA1F27 /* RemoteImage */,
|
|
||||||
03BCD74C2489365600DA1F27 /* WebView */,
|
03BCD74C2489365600DA1F27 /* WebView */,
|
||||||
|
03B2BAA7256556D100483FE3 /* URLImage */,
|
||||||
);
|
);
|
||||||
productName = MobileFort;
|
productName = MobileFort;
|
||||||
productReference = 03427F552488856C00A0073D /* MobileFort (iOS).app */;
|
productReference = 03427F552488856C00A0073D /* MobileFort (iOS).app */;
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
);
|
);
|
||||||
name = "MobileFort (macOS)";
|
name = "MobileFort (macOS)";
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
03B2BA7825654F4E00483FE3 /* RemoteImage */,
|
03B2BAA3256556C800483FE3 /* URLImage */,
|
||||||
);
|
);
|
||||||
productName = MobileFort;
|
productName = MobileFort;
|
||||||
productReference = 03B2BA5925654E9700483FE3 /* MobileFort (macOS).app */;
|
productReference = 03B2BA5925654E9700483FE3 /* MobileFort (macOS).app */;
|
||||||
|
@ -219,8 +219,8 @@
|
||||||
);
|
);
|
||||||
mainGroup = 03427F4C2488856C00A0073D;
|
mainGroup = 03427F4C2488856C00A0073D;
|
||||||
packageReferences = (
|
packageReferences = (
|
||||||
03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */,
|
|
||||||
03BCD74B2489365600DA1F27 /* XCRemoteSwiftPackageReference "SwiftUI-WebView" */,
|
03BCD74B2489365600DA1F27 /* XCRemoteSwiftPackageReference "SwiftUI-WebView" */,
|
||||||
|
03B2BAA2256556C800483FE3 /* XCRemoteSwiftPackageReference "url-image" */,
|
||||||
);
|
);
|
||||||
productRefGroup = 03427F562488856C00A0073D /* Products */;
|
productRefGroup = 03427F562488856C00A0073D /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
|
@ -551,12 +551,12 @@
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
/* Begin XCRemoteSwiftPackageReference section */
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */ = {
|
03B2BAA2256556C800483FE3 /* XCRemoteSwiftPackageReference "url-image" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/crelies/RemoteImage";
|
repositoryURL = "https://github.com/dmytro-anokhin/url-image";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 3.0.0;
|
minimumVersion = 2.1.9;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
03BCD74B2489365600DA1F27 /* XCRemoteSwiftPackageReference "SwiftUI-WebView" */ = {
|
03BCD74B2489365600DA1F27 /* XCRemoteSwiftPackageReference "SwiftUI-WebView" */ = {
|
||||||
|
@ -570,15 +570,15 @@
|
||||||
/* End XCRemoteSwiftPackageReference section */
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
/* Begin XCSwiftPackageProductDependency section */
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
03B2BA7825654F4E00483FE3 /* RemoteImage */ = {
|
03B2BAA3256556C800483FE3 /* URLImage */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */;
|
package = 03B2BAA2256556C800483FE3 /* XCRemoteSwiftPackageReference "url-image" */;
|
||||||
productName = RemoteImage;
|
productName = URLImage;
|
||||||
};
|
};
|
||||||
03BCD7472488985A00DA1F27 /* RemoteImage */ = {
|
03B2BAA7256556D100483FE3 /* URLImage */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */;
|
package = 03B2BAA2256556C800483FE3 /* XCRemoteSwiftPackageReference "url-image" */;
|
||||||
productName = RemoteImage;
|
productName = URLImage;
|
||||||
};
|
};
|
||||||
03BCD74C2489365600DA1F27 /* WebView */ = {
|
03BCD74C2489365600DA1F27 /* WebView */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
{
|
{
|
||||||
"object": {
|
"object": {
|
||||||
"pins": [
|
"pins": [
|
||||||
{
|
|
||||||
"package": "RemoteImage",
|
|
||||||
"repositoryURL": "https://github.com/crelies/RemoteImage",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "0a774642c744d653601d76b625c2cf290e363e52",
|
|
||||||
"version": "3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"package": "WebView",
|
"package": "WebView",
|
||||||
"repositoryURL": "https://github.com/kylehickinson/SwiftUI-WebView",
|
"repositoryURL": "https://github.com/kylehickinson/SwiftUI-WebView",
|
||||||
|
@ -18,6 +9,15 @@
|
||||||
"revision": "ec4352095428a06423868b3b2a92fdaa3c6281f7",
|
"revision": "ec4352095428a06423868b3b2a92fdaa3c6281f7",
|
||||||
"version": "0.2.0"
|
"version": "0.2.0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "URLImage",
|
||||||
|
"repositoryURL": "https://github.com/dmytro-anokhin/url-image",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "cedfdb207dcba2aec1229f3e2053bb93460a4244",
|
||||||
|
"version": "2.1.9"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue