iOS/Swift

Environment Set-up

Overview

In order to build an iOS app that uses HAT APIs, you first need to install the HAT for iOS library from github. To do so you can either manually download the library and add it to your project via drag n drop or you can use cocoapods and install it automagically.

Requirements

  • Xcode 10

  • Swift 4+

  • This guide does not show you how to set up the UI; you have to be able to design a basic UI in order to make everything work

Installing HAT for iOS library manually

To manually install the library you have to download the repo from github and add it to your project via drag n drop.

Installing HAT for iOS library via Cocoapods

Step 1

(If you are using cocoapods already you can skip this step)

Install cocoapods as described here

Step 2

(If you are using cocoapods already you can skip this step)

If you are not using cocoapods in your project you have to initialise pods first. To do so you have to run pod init via terminal in the project's root folder. That command will create the necessary files in your project.

Step 3

After initializing cocoapods there will be a new podfile file in your project. Open it and add the HatForIOS pod in your main target like this:

pod 'HAT-API-iOS'

Step 4

Open the terminal again and run pod install in the project's root folder. This will install HatForIOS pod in your project.

Step 5

Remember to always run the .xcworkspace file and not the .xcodeproj file.

Last updated