forked from couchbaselabs/hotel-lister-cordova
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
dd316aa
commit d9d50e7
Showing
4 changed files
with
39 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
** xref:hotel-lister:introduction.adoc[Introduction] | ||
** xref:hotel-lister:ios.adoc[iOS] | ||
** xref:hotel-lister:android.adoc[Android] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
= Introduction | ||
:tabs: | ||
|
||
In this tutorial, you will learn how to use Couchbase Lite in a Cordova application. | ||
|
||
The sample project is a Cordova web application that allows users to query for and display a list of hotels stored in a Couchbase Lite database. | ||
|
||
|
||
|
||
[{tabs}] | ||
==== | ||
Android:: | ||
+ | ||
image::ionic-listing-hotels.png[,250] | ||
|
||
iOS:: | ||
+ | ||
image::ionic-listing-hotels-ios.png[,250] | ||
==== | ||
|
||
== Architecture | ||
|
||
The user Interface is a web app written in Javascript using Ionic and is rendered within a WebView. The business logic and data model is written in native Swift. | ||
The data model uses Couchbase Lite as the embedded data persistence layer. | ||
The https://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html[Cordova Plugin API] acts as the bridging layer between the JavaScript and the native Swift worlds . The plugin exposes a Javascript API to the web app. | ||
|
||
This architecture allows you to write the User Interface code once for both iOS and Android apps while leveraging Couchbase Lite's native iOS framework for data management. | ||
|
||
image::arch-android.jpg[,400] | ||
|
||
== Data Model | ||
|
||
The data model for the app is very straightforward. | ||
There is one type of document: | ||
the _"hotel"_ document which contains the details of each hotel. | ||
Those documents have a `"type": "hotel"` property. | ||
|
||
image::data-model.png[,400] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters