Travel Sample Mobile App

    +

    Pre-requisites

    • Xcode 10.1+: downloadable latest version from the Mac App Store.

    • swift 5

    Getting Started

    • Clone the "master" branch of the Travel Sample app from GitHub. We are doing a shallow pull with depth as 1 to speed the cloning process.

      git clone -b master --depth 1 https://github.com/couchbaselabs/mobile-travel-sample.git

      You will have to download the compatible version of Couchbase Lite framework

    • In Terminal, navigate to the TravelSample directory.

      cd /path/to/mobile-travel-sample/ios/TravelSample
    • Run the following script to download and install Couchbase Lite. A script is provided to install Couchbase Lite comatible with different versions of Xcode and Swift.

      • Xcode 12+

      • Xcode 11.x

      • Xcode 11.0

      • Xcode 10.3

      • Xcode 10.2

      • Xcode 10.1

      sh install_12.sh
      sh install_11_1.sh
      sh install_11.sh
      sh install_10_2.sh
      sh install_10_2.sh
      sh install_10_1.sh
    • Open the TravelSample.xcodeproj using Xcode

    Configure App to connect to Backend

    You will have to update the URLs specified in the app to connect to the backend If you haven’t done so already, complete the steps outlined in the "Backend Installation" to install your Couchbase Server, Sync Gateway and Python web backend app.

    Updating the web backend URL

    Open the file QueryConsts.swift. You must update the webUrl constant which points to the Python Web Server.

    Now, the URLs that you specify will vary depending on the installation option that you chose for deploying your backend

    • Manual

    • Docker

    • Cloud

    static var webUrl:String = "http://localhost:8080"
    static var webUrl:String = "http://127.0.0.1:8080/"
    // Replace the hostname with the IP Address of the RightScale instance.
    // The example states `54.148.83.39` but yours will be different.
    static var webUrl:String = "http://54.148.83.39:8080/"

    Updating the Sync Gateway URL

    Next, you will update the Sync Gateway endpoint.

    Open the file DatabaseManager.swift. You must update the kRemoteSyncUrl constant. Now, the URLs that you specify will vary depending on the installation option that you chose for deploying your backend

    • Manual

    • Docker

    • Cloud

    let kRemoteSyncUrl = "ws://localhost:4984"
    let kRemoteSyncUrl = "ws://127.0.0.1:4984"
    // Replace the hostname with the IP Address of the RightScale instance.
    // The example states `54.148.83.39` but yours will be different.
    let kRemoteSyncUrl = "ws://54.148.83.39:4984"

    Try it Out

    • Build and run the project using simulator

    • Verify that the login screen appears in the simulator