Mastering Swift's Development Blog

Follow Us On Twitter
  • Jon Hoffman

Mastering Swift Cocktails App

Updated: Jul 15



Mastering Swift Cocktails is an Open Source iOS app, written in Swift and uses SwiftUI for the user interface. The code is distributed under the MIT license and can be found on my Github page here: https://github.com/hoffmanjon/Mastering_Swift_Cocktails


The app uses The Cocktail DB (https://www.thecocktaildb.com) as the backend data source. The Cocktail DB is an open, crowd sourced database of drinks on cocktails from around the world. It uses a free JSON API but also has a few paid premium APIs as well. The only premium APIs used in the Mastering Swift Cocktails App is the list of popular cocktails. This list will not work with the free test API key included with the source code. You can see the full list of APIs here: https://www.thecocktaildb.com/api.php


I wrote this app so I can use it as an example on how to develop an app that uses a webservice API as its backend data source. I plan on writing several posts that explain how the app was written and why I choose to do certain things within the code.


The key features of this app is to display recipes for cocktails. On the main screen you can see a list of popular cocktails with a horizontal scroll and a list of ingredients that you have selected as currently in your bar (use the bar tab options at the bottom of the screen to select the ingredients) which is also a horizontal scroll. There are two buttons on the main screen where one lets you see a list of drinks by the first character in the drinks name, and the other button lets you see a random recipe.


The app is currently on the App Store here


Some of the articles that I have written about how this app was developed are:


Replacing Static Variables and Constants with Enums

Caching AsyncImage SwiftUI

LazyHStack and LazyVStack


masteringSwift.jpeg

Mastering Swift 5.3

The sixth edition of this bestselling book, updated to cover through version 5.3 of the Swift programming language

Amazon

Packt

pop.jpeg

Protocol Oriented Programming

Embrace the Protocol-Oriented design paradigm, for better code maintainability and increased performance, with Swift.

Amazon

Packt