123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //
- // GiphyModel.swift
- // LiveLikeGiphyChallenge
- //
- // Created by Arbnor Tefiki on 6.2.22.
- //
- import Foundation
- struct GiphyModel: Decodable {
- var gifs: [Gif]
- var pagination: Pagination?
- var meta: Meta?
- enum CodingKeys: String, CodingKey {
- case gifs = "data"
- case pagination = "pagination"
- case meta = "meta"
- }
- }
- struct Gif: Decodable {
- var gifSources: GifImages
- enum CodingKeys: String, CodingKey {
- case gifSources = "images"
- }
- func getGifURL() -> String{
- return gifSources.fixedHeight.url
- }
- }
- struct GifImages: Decodable {
- var fixedHeight: GiphyContent
- enum CodingKeys: String, CodingKey {
- case fixedHeight = "fixed_height"
- }
- }
- struct GiphyContent: Decodable {
- var url: String
- }
- struct Pagination: Decodable {
- var offset: Int?
- var totalCount: Int?
- var count: Int?
- enum CodingKeys: String, CodingKey {
- case totalCount = "total_count"
- }
- }
- struct Meta: Decodable {
- var msg: String
- var status: Int
- }
|