Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 7cdf394

Browse files
committed
(っ˘▽˘)っ ☁️☁️☁️ ⊂(◕。◕⊂)
1 parent df6851f commit 7cdf394

File tree

8 files changed

+178
-17
lines changed

8 files changed

+178
-17
lines changed

.travis.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ env:
1212
- TEST_TYPE=OSX
1313
- TEST_TYPE=OSXDemo
1414
- TEST_TYPE=CocoaPods
15-
before_install:
15+
install:
1616
- |
17-
gem install cocoapods --pre --quiet --no-ri --no-rdoc
18-
pod setup --silent
19-
pod repo update --silent
20-
2117
if [ "$TEST_TYPE" = iOS ] || [ "$TEST_TYPE" = OSX ] || [ "$TEST_TYPE" = OSXDemo ]; then
22-
pod install
23-
gem install xcpretty -N --no-ri --no-rdoc
18+
bundle install
19+
bundle exec pod install
2420
fi
2521
script:
2622
- |

Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'xcpretty'
4+
gem 'cocoapods', '>= 1.0.0.beta.6'

Gemfile.lock

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
activesupport (4.2.6)
5+
i18n (~> 0.7)
6+
json (~> 1.7, >= 1.7.7)
7+
minitest (~> 5.1)
8+
thread_safe (~> 0.3, >= 0.3.4)
9+
tzinfo (~> 1.1)
10+
claide (1.0.0.beta.3)
11+
cocoapods (1.0.0.beta.6)
12+
activesupport (>= 4.0.2)
13+
claide (>= 1.0.0.beta.3, < 2.0)
14+
cocoapods-core (= 1.0.0.beta.6)
15+
cocoapods-deintegrate (>= 1.0.0.beta.1, < 2.0)
16+
cocoapods-downloader (>= 1.0.0.beta.2, < 2.0)
17+
cocoapods-plugins (>= 1.0.0.beta.1, < 2.0)
18+
cocoapods-search (>= 1.0.0.beta.1, < 2.0)
19+
cocoapods-stats (>= 1.0.0.beta.3, < 2.0)
20+
cocoapods-trunk (>= 1.0.0.beta.2, < 2.0)
21+
cocoapods-try (>= 1.0.0.beta.3, < 2.0)
22+
colored (~> 1.2)
23+
escape (~> 0.0.4)
24+
fourflusher (~> 0.3.0)
25+
molinillo (~> 0.4.4)
26+
nap (~> 1.0)
27+
xcodeproj (>= 1.0.0.beta.3, < 2.0)
28+
cocoapods-core (1.0.0.beta.6)
29+
activesupport (>= 4.0.2)
30+
fuzzy_match (~> 2.0.4)
31+
nap (~> 1.0)
32+
cocoapods-deintegrate (1.0.0.beta.1)
33+
cocoapods-downloader (1.0.0.beta.2)
34+
cocoapods-plugins (1.0.0.beta.1)
35+
nap
36+
cocoapods-search (1.0.0.beta.1)
37+
cocoapods-stats (1.0.0.beta.3)
38+
cocoapods-trunk (1.0.0.beta.2)
39+
nap (>= 0.8, < 2.0)
40+
netrc (= 0.7.8)
41+
cocoapods-try (1.0.0.beta.3)
42+
colored (1.2)
43+
escape (0.0.4)
44+
fourflusher (0.3.0)
45+
fuzzy_match (2.0.4)
46+
i18n (0.7.0)
47+
json (1.8.3)
48+
minitest (5.8.4)
49+
molinillo (0.4.4)
50+
nap (1.1.0)
51+
netrc (0.7.8)
52+
rouge (1.10.1)
53+
thread_safe (0.3.5)
54+
tzinfo (1.2.2)
55+
thread_safe (~> 0.1)
56+
xcodeproj (1.0.0.beta.3)
57+
activesupport (>= 3)
58+
claide (>= 1.0.0.beta.1, < 2.0)
59+
colored (~> 1.2)
60+
xcpretty (0.2.2)
61+
rouge (~> 1.8)
62+
63+
PLATFORMS
64+
ruby
65+
66+
DEPENDENCIES
67+
cocoapods (>= 1.0.0.beta.6)
68+
xcpretty
69+
70+
BUNDLED WITH
71+
1.11.2

ParseLiveQuery.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Pod::Spec.new do |s|
66
s.homepage = 'https://github.com/ParsePlatform/parse-server'
77
s.authors = { 'Richard Ross' => '[email protected]', 'Nikita Lutsenko' => '[email protected]' }
88

9-
s.source = { :git => 'https://github.com/ParsePlatform/LiveQueryClient-iOS-OSX.git', :tag => s.version.to_s }
9+
s.source = { :git => 'https://github.com/ParsePlatform/ParseLiveQuery-iOS-OSX.git', :tag => s.version.to_s }
1010

1111
s.requires_arc = true
1212

Podfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
use_frameworks!
55
workspace 'ParseLiveQuery.xcworkspace'
66

7-
target 'ParseLiveQuery OSX' do
7+
target 'ParseLiveQuery-OSX' do
88
project 'Sources/ParseLiveQuery.xcodeproj'
99
platform :osx, '10.10'
1010
pod 'Parse'
1111
pod 'Bolts-Swift'
1212
pod 'SocketRocket'
1313
end
1414

15-
target 'ParseLiveQuery iOS' do
15+
target 'ParseLiveQuery-iOS' do
1616
project 'Sources/ParseLiveQuery.xcodeproj'
1717
platform :ios, '8.0'
1818
pod 'Parse'

Podfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ SPEC CHECKSUMS:
1616
Parse: de2c52a9a1421b91ae7594ab8ce191afd184f19b
1717
SocketRocket: 2c51efccd2d73c99a923407ca4b06e7e9da95dbf
1818

19-
PODFILE CHECKSUM: 4982c01d12e5aa39b03d538361ee31261706147f
19+
PODFILE CHECKSUM: b9a8e3333816abb217972f59b02783395bc8c2e2
2020

2121
COCOAPODS: 1.0.0.beta.6

README.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Parse LiveQuery Client for iOS/OSX
2+
3+
[![Platforms][platforms-svg]][platforms-link]
4+
5+
[![Podspec][podspec-svg]][podspec-link]
6+
[![License][license-svg]][license-link]
7+
8+
[![Build Status][build-status-svg]][build-status-link]
9+
[![Coverage Status][coverage-status-svg]][coverage-status-link]
10+
11+
`PFQuery` is one of the key concepts for Parse. It allows you to retrieve `PFObject`s by specifying some conditions, making it easy to build apps such as a dashboard, a todo list or even some strategy games. However, `PFQuery` is based on a pull model, which is not suitable for apps that need real-time support.
12+
13+
Suppose you are building an app that allows multiple users to edit the same file at the same time. `PFQuery` would not be an ideal tool since you can not know when to query from the server to get the updates.
14+
15+
To solve this problem, we introduce Parse LiveQuery. This tool allows you to subscribe to a `PFQuery` you are interested in. Once subscribed, the server will notify clients whenever a `PFObject` that matches the `PFQuery` is created or updated, in real-time.
16+
17+
## Setup Server
18+
19+
Parse LiveQuery contains two parts, the LiveQuery server and the LiveQuery clients. In order to use live queries, you need to set up both of them.
20+
21+
The easiest way to setup the LiveQuery server is to make it run with the [Open Source Parse Server](https://github.com/ParsePlatform/parse-server/wiki/Parse-LiveQuery#server-setup).
22+
23+
## Install Client
24+
25+
### Cocoapods
26+
27+
You can install the LiveQuery client via including it in your Podfile:
28+
29+
pod 'ParseLiveQuery'
30+
31+
32+
## Use Client
33+
34+
The LiveQuery client interface is based around the concept of `Subscription`s. You can register any `PFQuery` for live updates from the associated live query server, by simply calling `subscribe()` on a query:
35+
```swift
36+
let myQuery = Message.query()!.where(....)
37+
let subscription: Subscription<Message> = myQuery.subscribe()
38+
```
39+
40+
Where `Message` is a registered subclass of PFObject.
41+
42+
Once you've subscribed to a query, you can `handle` events on them, like so:
43+
```swift
44+
subscription.handleEvent { query, event in
45+
// Handle event
46+
}
47+
```
48+
49+
You can also handle a single type of event, if that's all you're interested in:
50+
```swift
51+
subscription.handle(Event.Created) { query, object in
52+
// Called whenever an object was created
53+
}
54+
```
55+
56+
Handling errors is and other events is similar, take a look at the `Subscription` class for more information.
57+
58+
## Advanced Usage
59+
60+
You are not limited to a single Live Query Client - you can create your own instances of `Client` to manually control things like reconnecting, server URLs, and more.
61+
62+
## How Do I Contribute?
63+
64+
We want to make contributing to this project as easy and transparent as possible. Please refer to the [Contribution Guidelines][contributing].
65+
66+
[releases]: https://github.com/ParsePlatform/ParseLiveQuery-iOS-OSX/releases
67+
[contributing]: https://github.com/ParsePlatform/ParseLiveQuery-iOS-OSX/blob/master/CONTRIBUTING.md
68+
69+
[build-status-svg]: https://img.shields.io/travis/ParsePlatform/ParseLiveQuery-iOS-OSX/master.svg
70+
[build-status-link]: https://travis-ci.org/ParsePlatform/ParseLiveQuery-iOS-OSX/branches
71+
72+
[coverage-status-svg]: https://img.shields.io/codecov/c/github/ParsePlatform/ParseLiveQuery-iOS-OSX/master.svg
73+
[coverage-status-link]: https://codecov.io/github/ParsePlatform/ParseLiveQuery-iOS-OSX?branch=master
74+
75+
[license-svg]: https://img.shields.io/badge/license-BSD-lightgrey.svg
76+
[license-link]: https://github.com/ParsePlatform/ParseLiveQuery-iOS-OSX/blob/master/LICENSE
77+
78+
[podspec-svg]: https://img.shields.io/cocoapods/v/ParseLiveQuery.svg
79+
[podspec-link]: https://cocoapods.org/pods/ParseLiveQuery
80+
81+
[platforms-svg]: http://img.shields.io/cocoapods/p/ParseLiveQuery.svg?style=flat
82+
[platforms-link]: https://github.com/ParsePlatform/ParseLiveQuery-iOS-OSX

Sources/ParseLiveQuery.xcodeproj/project.pbxproj

+14-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
/* Begin PBXFileReference section */
3333
11F6DFE2732DB0DE49976BA5 /* Pods-ParseLiveQuery OSX.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery OSX.release.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery OSX/Pods-ParseLiveQuery OSX.release.xcconfig"; sourceTree = "<group>"; };
3434
6062D7994653A4F07D1358B9 /* Pods-ParseLiveQuery iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery iOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery iOS/Pods-ParseLiveQuery iOS.debug.xcconfig"; sourceTree = "<group>"; };
35+
7A40A16386D0D6B38F8B2F07 /* Pods-ParseLiveQuery-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery-iOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery-iOS/Pods-ParseLiveQuery-iOS.release.xcconfig"; sourceTree = "<group>"; };
3536
8445DD921B87567C1E6A6042 /* Pods-ParseLiveQuery OSX.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery OSX.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery OSX/Pods-ParseLiveQuery OSX.debug.xcconfig"; sourceTree = "<group>"; };
37+
89BFA3478A42D22F84D9F19C /* Pods-ParseLiveQuery-OSX.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery-OSX.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery-OSX/Pods-ParseLiveQuery-OSX.debug.xcconfig"; sourceTree = "<group>"; };
38+
9A79B9CA1B493BADC66AE15A /* Pods-ParseLiveQuery-OSX.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery-OSX.release.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery-OSX/Pods-ParseLiveQuery-OSX.release.xcconfig"; sourceTree = "<group>"; };
3639
AF5A55E51D52E372CD28FF08 /* Pods_ParseLiveQuery_OSX.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ParseLiveQuery_OSX.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3740
BE2643D85A7565FC20EE144C /* Pods_ParseLiveQuery_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ParseLiveQuery_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3841
E4BFFC7C2B6C5374CA5F7440 /* Pods-ParseLiveQuery iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery iOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery iOS/Pods-ParseLiveQuery iOS.release.xcconfig"; sourceTree = "<group>"; };
@@ -48,6 +51,7 @@
4851
F59CA92E1C8E496200329737 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Errors.swift; path = Internal/Errors.swift; sourceTree = "<group>"; };
4952
F5A88F491C9B6EBA002F0E0D /* PFQuery+Subscribe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PFQuery+Subscribe.swift"; sourceTree = "<group>"; };
5053
F5A9BFCA1BE0248D00E78326 /* ParseLiveQuery.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ParseLiveQuery.framework; sourceTree = BUILT_PRODUCTS_DIR; };
54+
FC3C8121FAAE363257898195 /* Pods-ParseLiveQuery-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery-iOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery-iOS/Pods-ParseLiveQuery-iOS.debug.xcconfig"; sourceTree = "<group>"; };
5155
/* End PBXFileReference section */
5256

5357
/* Begin PBXFrameworksBuildPhase section */
@@ -86,6 +90,10 @@
8690
11F6DFE2732DB0DE49976BA5 /* Pods-ParseLiveQuery OSX.release.xcconfig */,
8791
6062D7994653A4F07D1358B9 /* Pods-ParseLiveQuery iOS.debug.xcconfig */,
8892
E4BFFC7C2B6C5374CA5F7440 /* Pods-ParseLiveQuery iOS.release.xcconfig */,
93+
89BFA3478A42D22F84D9F19C /* Pods-ParseLiveQuery-OSX.debug.xcconfig */,
94+
9A79B9CA1B493BADC66AE15A /* Pods-ParseLiveQuery-OSX.release.xcconfig */,
95+
FC3C8121FAAE363257898195 /* Pods-ParseLiveQuery-iOS.debug.xcconfig */,
96+
7A40A16386D0D6B38F8B2F07 /* Pods-ParseLiveQuery-iOS.release.xcconfig */,
8997
);
9098
name = Pods;
9199
sourceTree = "<group>";
@@ -289,7 +297,7 @@
289297
);
290298
runOnlyForDeploymentPostprocessing = 0;
291299
shellPath = /bin/sh;
292-
shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-ParseLiveQuery OSX/Pods-ParseLiveQuery OSX-resources.sh\"\n";
300+
shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-ParseLiveQuery-OSX/Pods-ParseLiveQuery-OSX-resources.sh\"\n";
293301
showEnvVarsInLog = 0;
294302
};
295303
89E3C0C052352147C9B80227 /* 📦 Copy Pods Resources */ = {
@@ -304,7 +312,7 @@
304312
);
305313
runOnlyForDeploymentPostprocessing = 0;
306314
shellPath = /bin/sh;
307-
shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-ParseLiveQuery iOS/Pods-ParseLiveQuery iOS-resources.sh\"\n";
315+
shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-ParseLiveQuery-iOS/Pods-ParseLiveQuery-iOS-resources.sh\"\n";
308316
showEnvVarsInLog = 0;
309317
};
310318
/* End PBXShellScriptBuildPhase section */
@@ -367,7 +375,7 @@
367375
};
368376
F5903CF01BD999C500C3EFFE /* Debug */ = {
369377
isa = XCBuildConfiguration;
370-
baseConfigurationReference = 8445DD921B87567C1E6A6042 /* Pods-ParseLiveQuery OSX.debug.xcconfig */;
378+
baseConfigurationReference = 89BFA3478A42D22F84D9F19C /* Pods-ParseLiveQuery-OSX.debug.xcconfig */;
371379
buildSettings = {
372380
CLANG_ENABLE_MODULES = YES;
373381
CODE_SIGNING_REQUIRED = NO;
@@ -391,7 +399,7 @@
391399
};
392400
F5903CF11BD999C500C3EFFE /* Release */ = {
393401
isa = XCBuildConfiguration;
394-
baseConfigurationReference = 11F6DFE2732DB0DE49976BA5 /* Pods-ParseLiveQuery OSX.release.xcconfig */;
402+
baseConfigurationReference = 9A79B9CA1B493BADC66AE15A /* Pods-ParseLiveQuery-OSX.release.xcconfig */;
395403
buildSettings = {
396404
CLANG_ENABLE_MODULES = YES;
397405
CODE_SIGNING_REQUIRED = NO;
@@ -414,7 +422,7 @@
414422
};
415423
F5A9BFC81BE0248D00E78326 /* Debug */ = {
416424
isa = XCBuildConfiguration;
417-
baseConfigurationReference = 6062D7994653A4F07D1358B9 /* Pods-ParseLiveQuery iOS.debug.xcconfig */;
425+
baseConfigurationReference = FC3C8121FAAE363257898195 /* Pods-ParseLiveQuery-iOS.debug.xcconfig */;
418426
buildSettings = {
419427
CLANG_ENABLE_MODULES = YES;
420428
CODE_SIGNING_REQUIRED = NO;
@@ -438,7 +446,7 @@
438446
};
439447
F5A9BFC91BE0248D00E78326 /* Release */ = {
440448
isa = XCBuildConfiguration;
441-
baseConfigurationReference = E4BFFC7C2B6C5374CA5F7440 /* Pods-ParseLiveQuery iOS.release.xcconfig */;
449+
baseConfigurationReference = 7A40A16386D0D6B38F8B2F07 /* Pods-ParseLiveQuery-iOS.release.xcconfig */;
442450
buildSettings = {
443451
CLANG_ENABLE_MODULES = YES;
444452
CODE_SIGNING_REQUIRED = NO;

0 commit comments

Comments
 (0)