Using JSONEncoder to encode a variable with Codable as type Using JSONEncoder to encode a variable with Codable as type ios ios