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 RemoteImage
|
||||
import URLImage
|
||||
|
||||
extension String {
|
||||
func encodeUrl() -> String? {
|
||||
|
@ -13,15 +13,11 @@ struct PostView: View {
|
|||
var body: some View {
|
||||
VStack {
|
||||
HStack {
|
||||
RemoteImage(type: .url(URL(string: post.post.avatarUrl.encodeUrl()!)!), errorView: { error in
|
||||
Text(error.localizedDescription)
|
||||
}, imageView: { image in
|
||||
URLImage(url: URL(string: post.post.avatarUrl.encodeUrl()!)!) { image in
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
}, loadingView: {
|
||||
Text("Loading...")
|
||||
}).frame(width: 50.0, height: 50.0).padding(.leading)
|
||||
}.frame(width: 50.0, height: 50.0).padding(.leading)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
if post.post.isReblogged() {
|
||||
|
@ -40,15 +36,10 @@ struct PostView: View {
|
|||
ForEach(post.post.media) { media in
|
||||
if !media.url.isEmpty {
|
||||
VStack {
|
||||
RemoteImage(type: .url(URL(string: media.url.encodeUrl()!)!), errorView: { error in
|
||||
Text(error.localizedDescription)
|
||||
}, imageView: { image in
|
||||
URLImage(url: URL(string: media.url.encodeUrl()!)!) { image in
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
}, loadingView: {
|
||||
Text("Loading...")
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
|
@ -20,11 +18,43 @@
|
|||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
<key>UISceneConfigurations</key>
|
||||
<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>
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
03B2BA7025654F0500483FE3 /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03427F6C248887D200A0073D /* Common.swift */; };
|
||||
03B2BA7125654F0500483FE3 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03BCD7422488947200DA1F27 /* ProfileView.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 */; };
|
||||
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 */; };
|
||||
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 */; };
|
||||
03BCD74D2489365600DA1F27 /* WebView in Frameworks */ = {isa = PBXBuildFile; productRef = 03BCD74C2489365600DA1F27 /* WebView */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
@ -59,7 +59,7 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03BCD74D2489365600DA1F27 /* WebView in Frameworks */,
|
||||
03BCD7482488985A00DA1F27 /* RemoteImage in Frameworks */,
|
||||
03B2BAA8256556D100483FE3 /* URLImage in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -67,7 +67,7 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03B2BA7925654F4E00483FE3 /* RemoteImage in Frameworks */,
|
||||
03B2BAA4256556C800483FE3 /* URLImage in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -165,8 +165,8 @@
|
|||
);
|
||||
name = "MobileFort (iOS)";
|
||||
packageProductDependencies = (
|
||||
03BCD7472488985A00DA1F27 /* RemoteImage */,
|
||||
03BCD74C2489365600DA1F27 /* WebView */,
|
||||
03B2BAA7256556D100483FE3 /* URLImage */,
|
||||
);
|
||||
productName = MobileFort;
|
||||
productReference = 03427F552488856C00A0073D /* MobileFort (iOS).app */;
|
||||
|
@ -186,7 +186,7 @@
|
|||
);
|
||||
name = "MobileFort (macOS)";
|
||||
packageProductDependencies = (
|
||||
03B2BA7825654F4E00483FE3 /* RemoteImage */,
|
||||
03B2BAA3256556C800483FE3 /* URLImage */,
|
||||
);
|
||||
productName = MobileFort;
|
||||
productReference = 03B2BA5925654E9700483FE3 /* MobileFort (macOS).app */;
|
||||
|
@ -219,8 +219,8 @@
|
|||
);
|
||||
mainGroup = 03427F4C2488856C00A0073D;
|
||||
packageReferences = (
|
||||
03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */,
|
||||
03BCD74B2489365600DA1F27 /* XCRemoteSwiftPackageReference "SwiftUI-WebView" */,
|
||||
03B2BAA2256556C800483FE3 /* XCRemoteSwiftPackageReference "url-image" */,
|
||||
);
|
||||
productRefGroup = 03427F562488856C00A0073D /* Products */;
|
||||
projectDirPath = "";
|
||||
|
@ -551,12 +551,12 @@
|
|||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */ = {
|
||||
03B2BAA2256556C800483FE3 /* XCRemoteSwiftPackageReference "url-image" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/crelies/RemoteImage";
|
||||
repositoryURL = "https://github.com/dmytro-anokhin/url-image";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 3.0.0;
|
||||
minimumVersion = 2.1.9;
|
||||
};
|
||||
};
|
||||
03BCD74B2489365600DA1F27 /* XCRemoteSwiftPackageReference "SwiftUI-WebView" */ = {
|
||||
|
@ -570,15 +570,15 @@
|
|||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
03B2BA7825654F4E00483FE3 /* RemoteImage */ = {
|
||||
03B2BAA3256556C800483FE3 /* URLImage */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */;
|
||||
productName = RemoteImage;
|
||||
package = 03B2BAA2256556C800483FE3 /* XCRemoteSwiftPackageReference "url-image" */;
|
||||
productName = URLImage;
|
||||
};
|
||||
03BCD7472488985A00DA1F27 /* RemoteImage */ = {
|
||||
03B2BAA7256556D100483FE3 /* URLImage */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 03BCD7462488985A00DA1F27 /* XCRemoteSwiftPackageReference "RemoteImage" */;
|
||||
productName = RemoteImage;
|
||||
package = 03B2BAA2256556C800483FE3 /* XCRemoteSwiftPackageReference "url-image" */;
|
||||
productName = URLImage;
|
||||
};
|
||||
03BCD74C2489365600DA1F27 /* WebView */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "RemoteImage",
|
||||
"repositoryURL": "https://github.com/crelies/RemoteImage",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "0a774642c744d653601d76b625c2cf290e363e52",
|
||||
"version": "3.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "WebView",
|
||||
"repositoryURL": "https://github.com/kylehickinson/SwiftUI-WebView",
|
||||
|
@ -18,6 +9,15 @@
|
|||
"revision": "ec4352095428a06423868b3b2a92fdaa3c6281f7",
|
||||
"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