diff --git a/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift b/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift index d984e6713..d5e742e1e 100644 --- a/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift +++ b/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift @@ -56,7 +56,13 @@ public class Post: NSObject, BaseObjectDecodable { public let likeCount: Int public let links: [Link]? public let longitude: Double - public let originalPostIdentifier: String? + public var originalPostIdentifier: String? { + guard let originalPostId = originalPostIdentifierRaw else { + return nil + } + + return String(describing: originalPostId) + } public let originalPostUrl: String public let personIdentifier: String public let personFileUrl: String @@ -64,7 +70,11 @@ public class Post: NSObject, BaseObjectDecodable { public let personUsername: String public let postIdentifier: String public var postReplyCount: String? { - return String(describing: postReplyCountRaw) + guard let replyCount = postReplyCountRaw else { + return nil + } + + return String(describing: replyCount) } public let postUrl: String @@ -88,7 +98,11 @@ public class Post: NSObject, BaseObjectDecodable { public let postEntityIdentifier: String? public let personFileRelativePath: String? public var originalCrossPostIdentifier: String? { - return String(describing: originalCrossPostIdentifierRaw) + guard let originalCrossPostId = originalCrossPostIdentifierRaw else { + return nil + } + + return String(describing: originalCrossPostId) } // MARK: - Objective-C Representations of non-optional primitives @@ -109,6 +123,7 @@ public class Post: NSObject, BaseObjectDecodable { private let typeRaw: Int private let postReplyCountRaw: AnyJSONType? private let originalCrossPostIdentifierRaw: AnyJSONType? + private let originalPostIdentifierRaw: AnyJSONType? // MARK: - Decodable enum CodingKeys: String, CodingKey { @@ -129,7 +144,7 @@ public class Post: NSObject, BaseObjectDecodable { case links = "links" case longitude = "longitude" case originalCrossPostIdentifierRaw = "originalcrosspostid" - case originalPostIdentifier = "originalpostid" + case originalPostIdentifierRaw = "originalpostid" case originalPostUrl = "originalposturl" case personIdentifier = "personentityid" case personFileUrl = "personfileurl"