Travel Sample Mobile App
Pre-requisites
-
Xcode 12.5+: download the latest version from the Mac App Store.
-
swift 5.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 xcframework
-
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. Scripts are provided to install Couchbase Lite compatible with different versions of Xcode and Swift, here we use the version for Xcode 13.
sh install_13.sh
If you choose to use Xcode12.3+, you may be impacted by an issue in Xcode while using linked frameworks. Please follow the instructions outlined here to workaround the issue. -
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
static var webUrl:String = "http://localhost:8080"
static var webUrl:String = "http://127.0.0.1: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
let kRemoteSyncUrl = "ws://localhost:4984"
let kRemoteSyncUrl = "ws://127.0.0.1:4984"