Created
December 23, 2020 03:03
-
-
Save KevinGutowski/6bbd84eb8e9f255fec43aa65719935ea to your computer and use it in GitHub Desktop.
Trying to figure out how to encode response into swift objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct Gist:Codable { | |
let url: String | |
let files: [File] | |
} | |
struct File:Codable { | |
let filename,type,language,rawURL: String | |
let size: Int | |
enum CodingKeys: String, CodingKey { | |
case filename,type,language | |
case rawURL = "raw_url" | |
case size | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"url": "https://api.github.com/gists/8ee96d320c7b967bb479d00c3db6c450", | |
... | |
"files": { | |
"fileName1.js": { | |
"filename": "fileName1.js", | |
"type": "application/javascript", | |
"language": "JavaScript", | |
"raw_url": "https://gist.githubusercontent.com/KevinGutowski/8ee96d320c7b967bb479d00c3db6c450/raw/ad218219601e0791f1baa2f59bd2d4b4189cdd25/fileName1.js", | |
"size": 26 | |
}, | |
"fileName2.js": { | |
"filename": "fileName2.js", | |
"type": "application/javascript", | |
"language": "JavaScript", | |
"raw_url": "https://gist.githubusercontent.com/KevinGutowski/8ee96d320c7b967bb479d00c3db6c450/raw/64aa0a82a063a391a53b07f848411d8d8df407d4/fileName2.js", | |
"size": 19 | |
} | |
} | |
}, ...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment