diff --git a/MobileFort/MobileFort/Common.swift b/MobileFort/MobileFort/Common.swift index 3d1720a..ab4b036 100644 --- a/MobileFort/MobileFort/Common.swift +++ b/MobileFort/MobileFort/Common.swift @@ -1,7 +1,7 @@ import Foundation enum PostType: String, Decodable { - case picture + case text, picture } struct Media: Decodable, Identifiable { diff --git a/MobileFort/MobileFort/PostView.swift b/MobileFort/MobileFort/PostView.swift index 997d194..d32e302 100644 --- a/MobileFort/MobileFort/PostView.swift +++ b/MobileFort/MobileFort/PostView.swift @@ -38,16 +38,18 @@ struct PostView: View { VStack { ForEach(post.media) { media in - VStack { - RemoteImage(type: .url(URL(string: media.url.encodeUrl()!)!), errorView: { error in - Text(error.localizedDescription) - }, imageView: { image in - image - .resizable() - .aspectRatio(contentMode: .fit) - }, loadingView: { - Text("Loading...") - }) + if !media.url.isEmpty { + VStack { + RemoteImage(type: .url(URL(string: media.url.encodeUrl()!)!), errorView: { error in + Text(error.localizedDescription) + }, imageView: { image in + image + .resizable() + .aspectRatio(contentMode: .fit) + }, loadingView: { + Text("Loading...") + }) + } } } }