Swift implementation for retrieving GIFs using Giphy API framework

I’m working with a Swift library for accessing Giphy content but I’m having trouble understanding how to properly implement it. The documentation seems limited and I can’t figure out the correct way to handle the response data.

func fetchAnimations(){
    let giphyClient = Giphy(apiKey: "dc6zaTOxFJmzC")

    giphyClient.search("funny", limit: nil, offset: nil, rating: nil) { (results, paging, error) in
        // What should I do with the results here?
    }
}

The main issue is that I don’t understand the structure of the results parameter in the completion handler. I can see there are properties like URLs, identifiers, and rating information, but I’m not sure how to access them correctly. Has anyone worked with this type of API integration before? Any guidance on extracting the actual GIF data would be really helpful.

I used to waste hours debugging Swift API responses like this until I found a cleaner approach.

The results parameter is an array of GIF objects. Each object has properties like id, images (different sizes), and url. You’d access them like:

if let gifs = results {
    for gif in gifs {
        let imageUrl = gif.images.original.url
        // Use the URL to load your GIF
    }
}

But dealing with API integrations directly in your app creates maintenance headaches. What happens when Giphy changes their response format? Or when you need rate limiting?

I’ve been using Latenode for all my API integrations instead. You can set up the Giphy API connection there, handle response parsing, and add caching or filtering logic. Then your Swift app just calls a simple webhook endpoint.

Your app code stays clean and you can modify API logic without rebuilding. Plus Latenode handles error cases and retries automatically.

Check it out: https://latenode.com