Technical Documentations
  • 🇻🇳Vietnamese
    • Tổng quan
    • Đối tác B2B2C
      • Phương thức Webview
        • API Login
        • Yêu cầu bảo mật
        • Place Order
        • API Get Booking Detail
        • API Commit
        • API Check commit result
      • Phương thức SDK
        • API Login
        • Yêu cầu bảo mật
        • Initiate SDK
          • Init IOS SDK
          • Init Android SDK
        • Place order
        • API Commit
        • API Get booking detail
        • API Check commit result
      • Phương thức API
        • API Login
        • Yêu cầu bảo mật
        • ✈️Flight
          • Search API
          • Booking API
        • 🏨Hotel
          • Search API
          • Booking API
          • Cancellation API
        • Payment API
        • Booking Management API
    • Đối tác Corporate Agent (CA)
      • Qui trình tích hợp
      • API Chứng thực
      • Yêu cầu bảo mật
    • Đối tác Affiliate
    • ❓Câu hỏi thường gặp
      • Các status trong luồng booking Gotadi
      • Quy định Test
        • ✈️Vé máy bay
        • 🏨Khách sạn
      • Bộ Testcase dành cho đối tác B2B2C
      • Quy trình hỗ trợ từ CS
      • Danh sách Airlines
  • 🇬🇧English
    • Overview
    • B2B2C Partner
      • Webview method
        • API Login
        • Security Requirements
        • Place Order
        • API Get Booking Detail
        • API Commit
        • API Check commit result
      • SDK method
        • API Login
        • Security Requirments
        • Initiate SDK
          • Init IOS SDK
          • Init Android SDK
        • Place order
        • API Commit
        • API Get booking detail
        • API Check commit result
      • API method
        • Integration process
        • Login API
        • ✈️Flight
          • Search API
          • Booking API
        • 🏨Hotel
          • Search API
          • Booking API
          • Cancellation API
        • Payment API
    • Corporate Agent Partner (CA)
      • Integration Process
      • Authentication API
      • Security Requirements
    • Affiliate Partner
    • ❓FAQ section
      • Booking Statuses in Gotadi's Booking Flow
      • Regulations for Testing
        • ✈️Flight
        • 🏨Hotel
      • CS Support Overall Flow
      • Airlines List
Powered by GitBook
On this page
  • Import Gotadi SDK into an iOS Project
  • Example Code to Initialize IOSGotadiSDK
  1. English
  2. B2B2C Partner
  3. SDK method
  4. Initiate SDK

Init IOS SDK

Gotadi SDK Integration Guide for iOS

PreviousInitiate SDKNextInit Android SDK

Last updated 3 months ago

SDK link:

Import Gotadi SDK into an iOS Project

Add the Library Using Swift Package Manager

Use the SDK link above to add the library to your project via Swift Package Manager.

Build the project for the first time to import the GotadiSDK library.

Example Code to Initialize IOSGotadiSDK

  • Import IOSGotadiSDK

  • Initialize IOSGotadiSDK in viewDidLoad for performance optimization.

  • Init SDK and set up the partner environment with the following parameters:

    • env: Deployment environment [uat | prod]

    • partnername: Partner name, e.g., "vib"

    • language: Display language ["vi" | "en"]

    • token: JWT token obtained after authentication via Gotadi's API

    • theme: primary, secondary

import UIKit
import IOSGotadiSDK
class ViewController: UIViewController {
    let gotadiSDK: IOSGotadiSDK = IOSGotadiSDK.shared
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.

        //TODO: Call API authorize get Token from Gotadi
        gotadiSDK.setup(partnerSetting:
                        GotadiPartnerSetting(
                            env: "uat",
                            partnername: "vib",
                            language: "en", token: "token", theme: "primary"))
    }

        //TODO: Handle action push to gotadi search book
    @IBAction func gotoGotadiSearchBook(_ sender: Any) {
        gotadiSDK.pushToHomePartner(
            partnerViewController: self,
            handlePayment: {[weak self] gotadiViewController, bookingNumber in
                //TODO: Handle payment after checkout and receive bookingInfo
                print(bookingNumber)
                if let paymentViewController  =
                    self?.storyboard?.instantiateViewController(withIdentifier: "PaymentViewController")
                    as? PaymentViewController {
                        paymentViewController.bookingNumberResult = bookingNumber
                        gotadiViewController.navigationController?.pushViewController(paymentViewController, animated: true)
                }
        })
    }
}
🇬🇧
https://bitbucket.org/gotadigroup/gtd-ios-sdk