From 2bf082f2f9c7ce46c3e0843b9fddb4e2770915f2 Mon Sep 17 00:00:00 2001 From: redstrate <54911369+redstrate@users.noreply.github.com> Date: Thu, 4 Jun 2020 06:07:18 -0400 Subject: [PATCH] Show post's content in post view --- MobileFort/MobileFort/Common.swift | 9 +++++++++ MobileFort/MobileFort/PostView.swift | 2 ++ 2 files changed, 11 insertions(+) diff --git a/MobileFort/MobileFort/Common.swift b/MobileFort/MobileFort/Common.swift index ab4b036..1044280 100644 --- a/MobileFort/MobileFort/Common.swift +++ b/MobileFort/MobileFort/Common.swift @@ -14,6 +14,7 @@ struct OriginalPost: Decodable, Identifiable { let id: Int let title: String? + let content: String } struct Post: Decodable, Identifiable { @@ -43,6 +44,14 @@ struct Post: Decodable, Identifiable { return title } } + + func getContent() -> String { + if isReblogged() { + return originalPost!.content + } else { + return content + } + } } let mediaURL = "https://homepages.cae.wisc.edu/~ece533/images/airplane.png" diff --git a/MobileFort/MobileFort/PostView.swift b/MobileFort/MobileFort/PostView.swift index d32e302..a7107d6 100644 --- a/MobileFort/MobileFort/PostView.swift +++ b/MobileFort/MobileFort/PostView.swift @@ -52,6 +52,8 @@ struct PostView: View { } } } + + Text(post.getContent()) } }.frame(maxWidth: .infinity) }