Reputation: 976
I would like to show only the 1st image from Google Images via Swift 2 on my app. I was thinking about using Custom Search API, but I'm not sure if I found the right source to show this 1st image. Any tutorials?
Thanks
Upvotes: 0
Views: 6317
Reputation: 75
The Custom Search API is probably the best method (the only one that I know that is allowed). You need to obtain an API key from the Google Developers Console for a search engine. Then use this guide: Using REST to invoke the API.
Just be sure to include this parameter searchType="image"
in the request if you are grabbing image search results. You can specify how many results you want from your search.
Here is a tutorial on REST API calls and parsing JSON with Swift. From the request you receive an array in which you will be looking at the items and they will have a link
property which is the image URL. Here is a full list of response properties.
Upvotes: 3