An open API service indexing awesome lists of open source software.

https://github.com/couchbase-examples/ios-swift-cblite-userprofile-sync

About Quickstart in Couchbase Lite using a standalone database with iOS and Swift. This tutorial will show you how to use Sync Gateway to sync information between your local database and Couchbase Server.
https://github.com/couchbase-examples/ios-swift-cblite-userprofile-sync

couchbase couchbase-lite couchbase-mobile ios-swift swift

Last synced: about 1 month ago
JSON representation

About Quickstart in Couchbase Lite using a standalone database with iOS and Swift. This tutorial will show you how to use Sync Gateway to sync information between your local database and Couchbase Server.

Awesome Lists containing this project

README

          

# Quickstart in Couchbase Lite Sync with Swift and UIKit
#### Build an iOS App in Swift with Couchbase Lite

> Couchbase Sync Gateway is a key component of the Couchbase Mobile stack. It is an Internet-facing synchronization mechanism that securely syncs data across devices as well as between devices and the cloud. Couchbase Mobile 3.0 introduces centralized persistent module configuration of synchronization, which simplifies the administration of Sync Gateway clusters — see Sync Gateway Configuration.

The core functions of the Sync Gateway include

- Data Synchronization across devices and the cloud
- Authorization & Access Control
- Data Validation

This tutorial will demonstrate how to
- Setup the Couchbase Sync Gateway (with Docker) to sync content between multiple Couchbase Lite enabled clients. We will will cover the basics of the Sync Gateway Configuration.
- Configure your Sync Gateway to enforce data routing, access control and authorization. We will cover the basics of Sync Function API
- Configure your Couchbase Lite clients for replication with the Sync Gateway
- Use "Live Queries" or Query events within your Couchbase Lite clients to be asynchronously notified of changes

Full documentation can be found on the Couchbase Developer Portal.

## Prerequisites
To run this prebuilt project, you will need:

- Mac running MacOS 12 or 13
- Xcode 13/14 - Download latest version from the Mac App Store or via Xcodes

> **Note**: If you are using an older version of Xcode, which you need to retain for other development needs, make a copy of your existing version of Xcode and install the latest Xcode version. That way you can have multiple versions of Xcode on your Mac. More information can be found in [Apple's Developer Documentation](https://developer.apple.com/library/archive/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588-CH1-I_HAVE_MULTIPLE_VERSIONS_OF_XCODE_INSTALLED_ON_MY_MACHINE__WHAT_VERSION_OF_XCODE_DO_THE_COMMAND_LINE_TOOLS_CURRENTLY_USE_)
>
### Installing Couchbase Lite Framework

The [Couchbase Documentation](https://docs.couchbase.com/couchbase-lite/3.0/swift/gs-install.html) has examples on how to add Couchbase Lite via
- Swift Package Manager
- Cocoa Pods
- Carthage
- Direct Download

## App Architecture

The sample app follows the [MVP pattern](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter), separating the internal data model, from a passive view through a presenter that handles the logic of our application and acts as the conduit between the model and the view

## Try it out

* Open `src/UserProfileSyncDemo.xcodeproj` using Xcode
* Build and run the project.
* Verify that you see the login screen.

## Conclusion

This tutorial walked you through an example of how to use a Sync Gateway to synchronize data between Couchbase Lite enabled clients. We discussed how to configure your Sync Gateway to enforce relevant access control, authorization and data routing between Couchbase Lite enabled clients.