![]() The User Interfaceįirst of all, let’s jump to the main.storyboard and add in a few objects from the library with the following constraints: This class will parse the response of the Cocktail API into these classes.īy using Codable, the JSON response will be mapped automatically into the objects we have here. “Error: Cannot find Menu in scope”, let’s add it right away!Ĭreate a new Swift file called Cocktail.swift by right clicking on the “Margaritas PDFKit” Group and click on New File:Ĭall the file Cocktail.swift and click on Create. Fetching the Dataįetching and parsing the data is a little out of scope of this tutorial so let’s go through it quickly.Ĭreate a new Swift file, call it NetworkManager.swift Select Storyboard and Swift and click on Next and then Finish. I went ahead and called the App Margaritas PDFKit. Creating the Appįirst of all, let’s start by creating a new single view application by clicking on XCode, and selecting create a new XCode project. We are going to develop an app that generates a PDF showing us a list of all cocktails filtered by a string that the user will type in. This API also allows us to filter by drink.įor instance, using the URL “ ” would show us all the Margaritas. In this tutorial, we are going to generate a cocktail menu using the public thecocktaildb API.Īfter testing their search API on our browser with an empty search string “ ” we can see a list of cocktails with their ingredients as well as some instructions and additional data. Format your text (Font, Size, Underline…).Present your data in an organized fashion.Your users will be capable of creating on the go their own personalized reports that they will be able to export very easily. Generating PDF Reports dynamically can be extremely useful while developing Swift applications. ![]() ![]() Build a cocktail menu PDF using a public API Photo by Igor Stepanov on Unsplash ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |