I want to check if the print statement prints "Key: messageTimestamp" so that I can define let disucssionMessageTimestampKey = DiscussionMessage.CodingKeys.messageTimestamp.stringValue
. But I am getting an error 'CodingKeys' is inaccessible due to 'private' protection level
. I get this error when I try to access CodingKeys
in the file where the struct is defined or a different file. What am I missing? And is there no way I can access the default CodingKeys
?
struct DiscussionMessage: Codable {
let message, userCountryCode, userCountryEmoji, userName, userEmailAddress: String
let messageTimestamp: Double
let fcmToken, question, recordingUrl, profilePictureUrl: String?
}
let disucssionMessageTimestampKey = "messageTimestamp"
print("Key: ", DiscussionMessage.CodingKeys.messageTimestamp.stringValue)