Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Merge branch 'couchbaselite'
Browse files Browse the repository at this point in the history
  • Loading branch information
jchris committed Feb 6, 2013
2 parents 21cc84e + 5b084f1 commit f4e4d1e
Show file tree
Hide file tree
Showing 15 changed files with 228 additions and 364 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
xcuserdata/
build
DerivedData
Frameworks/
*.framework
80 changes: 32 additions & 48 deletions CouchDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions CouchDemo.xcodeproj/xcshareddata/xcschemes/CouchDemo.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
ReferencedContainer = "container:CouchDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-Log YES"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
<AdditionalOption
key = "MallocScribble"
Expand All @@ -71,11 +77,6 @@
value = "YES"
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
Expand Down
2 changes: 2 additions & 0 deletions Frameworks/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Put CouchbaseLite.framework in here!
(See the README.md for details)
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
## Grocery Sync for iOS

This is a simple demo app showing how to use the [Couchbase Mobile][1] framework to run [Apache CouchDB][2] on iOS. The app just presents a simple editable list of textual items, which are stored persistently in a local database, and shared in realtime via a syncpoint in the cloud.
This is a simple demo app showing how to use the [TouchDB][1] and [CouchCocoa][6] frameworks to embed a nonrelational ("NoSQL") [CouchDB][2]-compatible database in an iOS app and sync it with a database server in "the cloud".

**Keep in mind that the default is to share the globally shared grocery list.** To use a private grocery list, the user must create a password protected database and then direct Grocery Sync at it via the Settings application. URLs are specified in the form `http://username:password@myhost.iriscouch.com/grocery-sync`
Here's the "user story":

So this dude is at the grocery store picking up produce and checking it off on his phone. He's all proud looking when he is about to check off the last item on the list, but then... suddenly new items start appearing. Cut to his wife at home with the kids and she's adding items.
> "So this dude is at the grocery store picking up produce and checking it off on his phone. He's all proud looking when he is about to check off the last item on the list, but then ... suddenly new items start appearing. Cut to his wife at home with the kids, and she's adding items.
Okra? Ok. Coconut milk. But I already got regular milk! He checks them off as he goes. Cut to his wife who sees them marked done, she gets a big grin and starts adding cookies and ice cream and paper towels or whatever.
> "'Okra? Ok. Coconut milk? But I already got regular milk!' He checks them off as he goes. Cut to his wife who sees them marked done; she gets a big grin and starts adding cookies and ice cream and paper towels or whatever."
The app just presents a simple editable list of textual items with checkboxes, which are stored persistently in a local database, and shared in realtime with all other users who are synced with the same cloud database.

Syncing is not enabled by default. To sync, press the "Configure" button and enter the URL of a Couchbase Sync Gateway instace. For more info about setting up the Sync Gateway, [read the getting started guide](https://github.com/couchbaselabs/mobile)

## Getting Started

These instructions assume you are familiar with how to make an iPhone app. Please follow them fully and in order the first time you build.

If you have questions or get stuck or just want to say hi, please visit the [Mobile Couchbase group][4] on Google Groups.

Prerequisite: Xcode 4.0.2 or later with the SDK for iOS 4 or later. (It's possible the project might still work with Xcode 3, but we're not testing or supporting this anymore.)
Prerequisite: Xcode 4.2 or later with the SDK for iOS 4 or later.


## Building The Demo App

Expand All @@ -24,8 +29,9 @@ Prerequisite: Xcode 4.0.2 or later with the SDK for iOS 4 or later. (It's possib

### Get the frameworks (CouchCocoa as well as the embedded Couchbase server)

1. [Download and unzip the latest][1] compiled Couchbase.framework. (Building this is messy, you probably don't want to do it yourself.)
2. Copy both Couchbase.framework and CouchCocoa.framework into the Frameworks directory of this repo.
1. Either [download a compiled build][7] of TouchDB, or [check out][1] and build it yourself (be sure to follow its README.)
2. Likewise, either [download a compiled build][5] of CouchCocoa, or [check out][6] and build it yourself (be sure to follow its README.)
2. Copy both `Couchbase.framework` and `CouchCocoa.framework` (the ones for iOS, not Mac OS!) into the `Frameworks` directory of this repo.

### Open the Xcode workspace

Expand All @@ -38,21 +44,24 @@ Prerequisite: Xcode 4.0.2 or later with the SDK for iOS 4 or later. (It's possib

That's it! Now that you're set up, you can just use the Run command again after making changes to the demo code.


## To add the framework to your existing Xcode project

Please see the documentation on the [Couchbase Mobile][1] home page.
Please see the documentation for [TouchDB][1] and [CouchCocoa][1].

## License

Portions under Apache, Erlang, and other licenses.
## License

The overall package is released under the Apache license, 2.0.
Released under the Apache license, 2.0.

Copyright 2011, Couchbase, Inc.
Copyright 2011-2012, Couchbase, Inc.


[1]: http://www.couchbase.org/get/couchbase-mobile-for-ios/current
[1]: https://github.com/couchbaselabs/TouchDB-iOS/
[2]: http://couchdb.apache.org
[4]: https://groups.google.com/group/mobile-couchbase
[5]: https://github.com/couchbaselabs/CouchCocoa/downloads
[6]: https://github.com/couchbaselabs/CouchCocoa/
[7]: https://github.com/couchbaselabs/TouchDB-iOS/downloads
[8]: http://iriscouch.com
[9]: http://cloudant.com
109 changes: 27 additions & 82 deletions Resources/RootViewController.xib
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">11B26</string>
<string key="IBDocument.InterfaceBuilderVersion">1934</string>
<string key="IBDocument.AppKitVersion">1138</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">931</string>
<string key="NS.object.0">2083</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBProxyObject</string>
<string>IBUICustomObject</string>
<string>IBUITableView</string>
<string>IBUIImageView</string>
<string>IBUIView</string>
<string>IBUITableView</string>
<string>IBUITextField</string>
<string>IBProxyObject</string>
<string>IBUIView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -67,64 +67,8 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">10</int>
<object class="NSImage" key="NSImage">
<int key="NSImageFlags">549453824</int>
<string key="NSSize">{512, 1}</string>
<object class="NSMutableArray" key="NSReps">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="0"/>
<object class="NSBitmapImageRep">
<object class="NSData" key="NSTIFFRepresentation">
<bytes key="NS.bytes">TU0AKgAACAjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1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NT/
xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
xczS/8vS2P/L0tj/xczU/wANAQAAAwAAAAECAAAAAQEAAwAAAAEAAQAAAQIAAwAAAAQAAAiqAQMAAwAA
AAEAAQAAAQYAAwAAAAEAAgAAAREABAAAAAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEABAAAARYAAwAA
AAEAAQAAARcABAAAAAEAAAgAARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAQAAAiyAAAAAAAI
AAgACAAIAAEAAQABAAE</bytes>
</object>
</object>
</object>
</object>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
</object>
</object>
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAgMAA</bytes>
<string key="IBUIColorCocoaTouchKeyPath">groupTableViewBackgroundColor</string>
</object>
<bool key="IBUIClipsSubviews">YES</bool>
Expand Down Expand Up @@ -217,14 +161,15 @@ AAgACAAIAAEAAQABAAE</bytes>
<integer value="1"/>
<integer value="3"/>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{320, 480}</string>
<string>{480, 320}</string>
</object>
</object>
<string key="IBUITargetRuntime">IBCocoaTouchFramework</string>
<string key="IBUIDisplayName">iPhone/iPod touch Full Screen</string>
<string key="IBUIDisplayName">Retina 3.5 Full Screen</string>
<int key="IBUIType">0</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
Expand Down Expand Up @@ -392,7 +337,7 @@ AAgACAAIAAEAAQABAAE</bytes>
<string>7.IBAttributePlaceholdersKey</string>
<string>7.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>RootViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
Expand All @@ -401,7 +346,7 @@ AAgACAAIAAEAAQABAAE</bytes>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>CouchUITableSource</string>
<string>CBLUITableSource</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSMutableDictionary">
Expand Down Expand Up @@ -430,7 +375,7 @@ AAgACAAIAAEAAQABAAE</bytes>
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">CouchUITableSource</string>
<string key="className">CBLUITableSource</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">tableView</string>
Expand All @@ -445,7 +390,7 @@ AAgACAAIAAEAAQABAAE</bytes>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/CouchUITableSource.h</string>
<string key="minorKey">./Classes/CBLUITableSource.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
Expand All @@ -458,7 +403,7 @@ AAgACAAIAAEAAQABAAE</bytes>
<string>configureSync:</string>
<string>deleteCheckedItems:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
Expand All @@ -471,7 +416,7 @@ AAgACAAIAAEAAQABAAE</bytes>
<string>configureSync:</string>
<string>deleteCheckedItems:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">configureSync:</string>
Expand All @@ -493,11 +438,11 @@ AAgACAAIAAEAAQABAAE</bytes>
<string>progress</string>
<string>tableView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIImageView</string>
<string>UITextField</string>
<string>CouchUITableSource</string>
<string>CBLUITableSource</string>
<string>UIProgressView</string>
<string>UITableView</string>
</object>
Expand All @@ -512,7 +457,7 @@ AAgACAAIAAEAAQABAAE</bytes>
<string>progress</string>
<string>tableView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">addItemBackground</string>
Expand All @@ -524,7 +469,7 @@ AAgACAAIAAEAAQABAAE</bytes>
</object>
<object class="IBToOneOutletInfo">
<string key="name">dataSource</string>
<string key="candidateClassName">CouchUITableSource</string>
<string key="candidateClassName">CBLUITableSource</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">progress</string>
Expand All @@ -547,7 +492,7 @@ AAgACAAIAAEAAQABAAE</bytes>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1280" key="NS.object.0"/>
<real value="1552" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
Expand All @@ -562,12 +507,12 @@ AAgACAAIAAEAAQABAAE</bytes>
<string>background.jpg</string>
<string>textfield___inactive.png</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{320, 416}</string>
<string>{300, 43}</string>
</object>
</object>
<string key="IBCocoaTouchPluginVersion">931</string>
<string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>
Empty file removed Resources/grocery-sync.couch
Empty file.
4 changes: 2 additions & 2 deletions Source/ConfigViewController.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//
// ConfigViewController.h
// CouchDemo
// CBLDemo
//
// Created by Jens Alfke on 8/8/11.
// Copyright 2011 Couchbase, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>
@class CouchServer;
@class CBLServer;

@interface ConfigViewController : UIViewController

Expand Down
5 changes: 2 additions & 3 deletions Source/ConfigViewController.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ConfigViewController.m
// CouchDemo
// CBLDemo
//
// Created by Jens Alfke on 8/8/11.
// Copyright 2011 Couchbase, Inc. All rights reserved.
Expand Down Expand Up @@ -28,7 +28,7 @@ - (id)init {
style:UIBarButtonItemStyleDone
target: self
action: @selector(done:)];
self.navigationItem.leftBarButtonItem = [purgeButton autorelease];
self.navigationItem.leftBarButtonItem = purgeButton;
}
return self;
}
Expand Down Expand Up @@ -79,7 +79,6 @@ - (IBAction)done:(id)sender {
cancelButtonTitle: @"Fix It"
otherButtonTitles: @"Revert", nil];
[alert show];
[alert release];
return;
}

Expand Down
Loading

0 comments on commit f4e4d1e

Please sign in to comment.