Compare commits
No commits in common. "master" and "gh-pages" have entirely different histories.
|
@ -1,29 +0,0 @@
|
||||||
# OS X
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# Xcode
|
|
||||||
build/
|
|
||||||
*.pbxuser
|
|
||||||
!default.pbxuser
|
|
||||||
*.mode1v3
|
|
||||||
!default.mode1v3
|
|
||||||
*.mode2v3
|
|
||||||
!default.mode2v3
|
|
||||||
*.perspectivev3
|
|
||||||
!default.perspectivev3
|
|
||||||
xcuserdata
|
|
||||||
*.xccheckout
|
|
||||||
profile
|
|
||||||
*.moved-aside
|
|
||||||
DerivedData
|
|
||||||
*.hmap
|
|
||||||
*.ipa
|
|
||||||
|
|
||||||
# Bundler
|
|
||||||
.bundle
|
|
||||||
|
|
||||||
Carthage
|
|
||||||
Cartfile.resolved
|
|
||||||
|
|
||||||
# SPM
|
|
||||||
.build/
|
|
3
Cartfile
3
Cartfile
|
@ -1,3 +0,0 @@
|
||||||
github "krzyzanowskim/CryptoSwift"
|
|
||||||
github "tidwall/SwiftWebSocket"
|
|
||||||
github "DaveWoodCom/XCGLogger"
|
|
|
@ -1,2 +0,0 @@
|
||||||
github "Quick/Nimble" # Not building with Swift 2.2
|
|
||||||
github "Quick/Quick" # Not building with Swift 2.2
|
|
|
@ -0,0 +1,372 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Classes Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="js/jquery.min.js" defer></script>
|
||||||
|
<script src="js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a title="Classes Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="img/carat.png" />
|
||||||
|
Classes Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>Classes</h1>
|
||||||
|
<p>The following classes are available globally.</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP9DDPClient"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/DDPClient" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP9DDPClient">DDPClient</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>DDPClient is the base class for communicating with a server using the DDP protocol</p>
|
||||||
|
|
||||||
|
<a href="Classes/DDPClient.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">DDPClient</span><span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP5EJSON"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/EJSON" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP5EJSON">EJSON</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
<a href="Classes/EJSON.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP16MeteorCollection"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/MeteorCollection" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP16MeteorCollection">MeteorCollection</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
<a href="Classes/MeteorCollection.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP18AbstractCollection"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/AbstractCollection" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP18AbstractCollection">AbstractCollection</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
<a href="Classes/AbstractCollection.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP19MeteorOAuthServices"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/MeteorOAuthServices" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP19MeteorOAuthServices">MeteorOAuthServices</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
<a href="Classes/MeteorOAuthServices.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP14MeteorDocument"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/MeteorDocument" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP14MeteorDocument">MeteorDocument</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
<a href="Classes/MeteorDocument.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<div class="task-name-container">
|
||||||
|
<a name="/TODO:%20Login%20first%20with%20stored%20token"></a>
|
||||||
|
<a name="//apple_ref/swift/Section/TODO: Login first with stored token" class="dashAnchor"></a>
|
||||||
|
<a href="#/TODO:%20Login%20first%20with%20stored%20token">
|
||||||
|
<h3 class="section-name">TODO: Login first with stored token</h3>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP31MeteorOAuthDialogViewController"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/MeteorOAuthDialogViewController" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP31MeteorOAuthDialogViewController">MeteorOAuthDialogViewController</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
<a href="Classes/MeteorOAuthDialogViewController.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP11MeteorOAuth"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/MeteorOAuth" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:C8SwiftDDP6Meteor"></a>
|
||||||
|
<a name="//apple_ref/swift/Class/Meteor" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:C8SwiftDDP6Meteor">Meteor</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Meteor is a class to simplify communicating with and consuming MeteorJS server services</p>
|
||||||
|
|
||||||
|
<a href="Classes/Meteor.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Meteor</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,415 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>AbstractCollection Class Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Class/AbstractCollection" class="dashAnchor"></a>
|
||||||
|
<a title="AbstractCollection Class Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
AbstractCollection Class Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>AbstractCollection</h1>
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vC8SwiftDDP18AbstractCollection4nameSS"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/name" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vC8SwiftDDP18AbstractCollection4nameSS">name</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vC8SwiftDDP18AbstractCollection6clientCCS_6Meteor6Client"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/client" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vC8SwiftDDP18AbstractCollection6clientCCS_6Meteor6Client">client</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP18AbstractCollectioncFT4nameSS_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/init(name:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP18AbstractCollectioncFT4nameSS_S0_">init(name:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP18AbstractCollection16documentWasAddedFTSS2idSS6fieldsGSqCSo12NSDictionary__T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasAdded(_:id:fields:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP18AbstractCollection16documentWasAddedFTSS2idSS6fieldsGSqCSo12NSDictionary__T_">documentWasAdded(_:id:fields:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Invoked when a document has been sent from the server.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">documentWasAdded</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?)</span> <span class="p">{}</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>fields</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional NSDictionary with the documents properties</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP18AbstractCollection18documentWasChangedFTSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqGSaSS___T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasChanged(_:id:fields:cleared:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP18AbstractCollection18documentWasChangedFTSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqGSaSS___T_">documentWasChanged(_:id:fields:cleared:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Invoked when a document has been changed on the server.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">documentWasChanged</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?,</span> <span class="nv">cleared</span><span class="p">:[</span><span class="kt">String</span><span class="p">]?)</span> <span class="p">{}</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>fields</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional NSDictionary with the documents properties</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>cleared</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>Optional array of strings (field names to delete)</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP18AbstractCollection18documentWasRemovedFTSS2idSS_T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasRemoved(_:id:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP18AbstractCollection18documentWasRemovedFTSS2idSS_T_">documentWasRemoved(_:id:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Invoked when a document has been removed on the server.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">documentWasRemoved</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">)</span> <span class="p">{}</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,212 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>EJSON Class Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Class/EJSON" class="dashAnchor"></a>
|
||||||
|
<a title="EJSON Class Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
EJSON Class Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>EJSON</h1>
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:ZFC8SwiftDDP5EJSON7isEJSONFSSSb"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/isEJSON(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:ZFC8SwiftDDP5EJSON7isEJSONFSSSb">isEJSON(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Determines whether a given key is an eJSON key</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">isEJSON</span><span class="p">(</span><span class="nv">key</span><span class="p">:</span><span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:ZFC8SwiftDDP5EJSON15convertToNSDateFCSo12NSDictionaryCSo6NSDate"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/convertToNSDate(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:ZFC8SwiftDDP5EJSON15convertToNSDateFCSo12NSDictionaryCSo6NSDate">convertToNSDate(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Converts an eJSON date to NSDate</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">convertToNSDate</span><span class="p">(</span><span class="nv">ejson</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">)</span> <span class="o">-></span> <span class="kt">NSDate</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:ZFC8SwiftDDP5EJSON18convertToEJSONDateFCSo6NSDateGVs10DictionarySSSd_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/convertToEJSONDate(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:ZFC8SwiftDDP5EJSON18convertToEJSONDateFCSo6NSDateGVs10DictionarySSSd_">convertToEJSONDate(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,394 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Client Class Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Class/Client" class="dashAnchor"></a>
|
||||||
|
<a title="Client Class Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../../img/carat.png" />
|
||||||
|
Client Class Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>Client</h1>
|
||||||
|
<div class="declaration">
|
||||||
|
<div class="language">
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Client</span><span class="p">:</span> <span class="kt">DDPClient</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>Meteor.Client is a subclass of DDPClient that facilitates interaction with the MeteorCollection class</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FCC8SwiftDDP6Meteor6ClientcFT3urlSS5emailSS8passwordSS_S1_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/init(url:email:password:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FCC8SwiftDDP6Meteor6ClientcFT3urlSS5emailSS8passwordSS_S1_">init(url:email:password:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Client</span><span class="p">:</span> <span class="kt">DDPClient</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FCC8SwiftDDP6Meteor6Client16documentWasAddedFTSS2idSS6fieldsGSqCSo12NSDictionary__T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasAdded(_:id:fields:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FCC8SwiftDDP6Meteor6Client16documentWasAddedFTSS2idSS6fieldsGSqCSo12NSDictionary__T_">documentWasAdded(_:id:fields:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Calls the documentWasAdded method in the MeteorCollection subclass instance associated with the document
|
||||||
|
collection</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">documentWasAdded</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>fields</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional NSDictionary with the documents properties</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FCC8SwiftDDP6Meteor6Client18documentWasChangedFTSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqGSaSS___T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasChanged(_:id:fields:cleared:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FCC8SwiftDDP6Meteor6Client18documentWasChangedFTSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqGSaSS___T_">documentWasChanged(_:id:fields:cleared:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Calls the documentWasChanged method in the MeteorCollection subclass instance associated with the document
|
||||||
|
collection</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">documentWasChanged</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?,</span> <span class="nv">cleared</span><span class="p">:[</span><span class="kt">String</span><span class="p">]?)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>fields</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional NSDictionary with the documents properties</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>cleared</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional array of string property names to delete</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FCC8SwiftDDP6Meteor6Client18documentWasRemovedFTSS2idSS_T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasRemoved(_:id:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FCC8SwiftDDP6Meteor6Client18documentWasRemovedFTSS2idSS_T_">documentWasRemoved(_:id:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Calls the documentWasRemoved method in the MeteorCollection subclass instance associated with the document
|
||||||
|
collection</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">documentWasRemoved</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,699 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>MeteorCollection Class Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Class/MeteorCollection" class="dashAnchor"></a>
|
||||||
|
<a title="MeteorCollection Class Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
MeteorCollection Class Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>MeteorCollection</h1>
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vC8SwiftDDP16MeteorCollection6sortedGSax_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/sorted" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vC8SwiftDDP16MeteorCollection6sortedGSax_">sorted</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vC8SwiftDDP16MeteorCollection5countSi"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/count" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vC8SwiftDDP16MeteorCollection5countSi">count</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Returns the number of documents in the collection</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">count</span><span class="p">:</span><span class="kt">Int</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollectioncFT4nameSS_GS0_x_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/init(name:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollectioncFT4nameSS_GS0_x_">init(name:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Initializes a MeteorCollection object</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">override</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>name</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>The string name of the collection (must match the name of the collection on the server)</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollection7findOneFSSGSqx_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/findOne(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollection7findOneFSSGSqx_">findOne(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Find a single document by id</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">findOne</span><span class="p">(</span><span class="nv">id</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">T</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the id of the document</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollection16documentWasAddedFTSS2idSS6fieldsGSqCSo12NSDictionary__T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasAdded(_:id:fields:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollection16documentWasAddedFTSS2idSS6fieldsGSqCSo12NSDictionary__T_">documentWasAdded(_:id:fields:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Invoked when a document has been sent from the server.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">documentWasAdded</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>fields</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional NSDictionary with the documents properties</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollection18documentWasChangedFTSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqGSaSS___T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasChanged(_:id:fields:cleared:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollection18documentWasChangedFTSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqGSaSS___T_">documentWasChanged(_:id:fields:cleared:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Invoked when a document has been changed on the server.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">documentWasChanged</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?,</span> <span class="nv">cleared</span><span class="p">:[</span><span class="kt">String</span><span class="p">]?)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>fields</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional NSDictionary with the documents properties</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>cleared</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>Optional array of strings (field names to delete)</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollection18documentWasRemovedFTSS2idSS_T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasRemoved(_:id:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollection18documentWasRemovedFTSS2idSS_T_">documentWasRemoved(_:id:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Invoked when a document has been removed on the server.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">documentWasRemoved</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollection6insertFxT_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/insert(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollection6insertFxT_">insert(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Client-side method to insert a document</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">insert</span><span class="p">(</span><span class="nv">document</span><span class="p">:</span> <span class="kt">T</span><span class="p">)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>document</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>a document that inherits from MeteorDocument</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollection6updateFTx18withMongoOperationGVs10DictionarySSPs9AnyObject___T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/update(_:withMongoOperation:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollection6updateFTx18withMongoOperationGVs10DictionarySSPs9AnyObject___T_">update(_:withMongoOperation:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Client-side method to update a document</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">update</span><span class="p">(</span><span class="nv">document</span><span class="p">:</span> <span class="kt">T</span><span class="p">,</span> <span class="n">withMongoOperation</span> <span class="nv">operation</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span><span class="kt">AnyObject</span><span class="p">])</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>document</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>a document that inherits from MeteorDocument</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>operation</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>a dictionary containing a Mongo selector and a json object</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollection6updateFxT_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/update(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollection6updateFxT_">update(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Client-side method to update a document</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">update</span><span class="p">(</span><span class="nv">document</span><span class="p">:</span> <span class="kt">T</span><span class="p">)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>document</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>a document that inherits from MeteorDocument</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP16MeteorCollection6removeFxT_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/remove(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP16MeteorCollection6removeFxT_">remove(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Client-side method to remove a document</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">remove</span><span class="p">(</span><span class="nv">document</span><span class="p">:</span> <span class="kt">T</span><span class="p">)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>document</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>a document that inherits from MeteorDocument</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,177 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>MeteorDocument Class Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Class/MeteorDocument" class="dashAnchor"></a>
|
||||||
|
<a title="MeteorDocument Class Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
MeteorDocument Class Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>MeteorDocument</h1>
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP14MeteorDocumentcFT2idSS6fieldsGSqCSo12NSDictionary__S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/init(id:fields:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP14MeteorDocumentcFT2idSS6fieldsGSqCSo12NSDictionary__S0_">init(id:fields:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FC8SwiftDDP14MeteorDocument6updateFTGSqCSo12NSDictionary_7clearedGSqGSaSS___T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/update(_:cleared:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FC8SwiftDDP14MeteorDocument6updateFTGSqCSo12NSDictionary_7clearedGSqGSaSS___T_">update(_:cleared:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,158 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Enums Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="js/jquery.min.js" defer></script>
|
||||||
|
<script src="js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a title="Enums Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="img/carat.png" />
|
||||||
|
Enums Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>Enums</h1>
|
||||||
|
<p>The following enums are available globally.</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:O8SwiftDDP14DDPMessageType"></a>
|
||||||
|
<a name="//apple_ref/swift/Enum/DDPMessageType" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:O8SwiftDDP14DDPMessageType">DDPMessageType</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
<a href="Enums/DDPMessageType.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,480 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>DDPMessageType Enum Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Enum/DDPMessageType" class="dashAnchor"></a>
|
||||||
|
<a title="DDPMessageType Enum Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
DDPMessageType Enum Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>DDPMessageType</h1>
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType9ConnectedFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Connected" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType9ConnectedFMS0_S0_">Connected</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType6FailedFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Failed" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType6FailedFMS0_S0_">Failed</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType4PingFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Ping" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType4PingFMS0_S0_">Ping</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType4PongFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Pong" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType4PongFMS0_S0_">Pong</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType5NosubFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Nosub" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType5NosubFMS0_S0_">Nosub</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType5AddedFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Added" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType5AddedFMS0_S0_">Added</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType7ChangedFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Changed" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType7ChangedFMS0_S0_">Changed</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType7RemovedFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Removed" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType7RemovedFMS0_S0_">Removed</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType5ReadyFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Ready" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType5ReadyFMS0_S0_">Ready</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType11AddedBeforeFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/AddedBefore" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType11AddedBeforeFMS0_S0_">AddedBefore</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType11MovedBeforeFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/MovedBefore" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType11MovedBeforeFMS0_S0_">MovedBefore</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType6ResultFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Result" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType6ResultFMS0_S0_">Result</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType7UpdatedFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Updated" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType7UpdatedFMS0_S0_">Updated</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType5ErrorFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Error" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType5ErrorFMS0_S0_">Error</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FO8SwiftDDP14DDPMessageType9UnhandledFMS0_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Element/Unhandled" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FO8SwiftDDP14DDPMessageType9UnhandledFMS0_S0_">Unhandled</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,199 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Global Variables Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="js/jquery.min.js" defer></script>
|
||||||
|
<script src="js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a title="Global Variables Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="img/carat.png" />
|
||||||
|
Global Variables Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>Global Variables</h1>
|
||||||
|
<p>The following global variables are available globally.</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS"></a>
|
||||||
|
<a name="//apple_ref/swift/Global/METEOR_COLLECTION_SET_DID_CHANGE" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:v8SwiftDDP18DDP_USER_DID_LOGINSS"></a>
|
||||||
|
<a name="//apple_ref/swift/Global/DDP_USER_DID_LOGIN" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS"></a>
|
||||||
|
<a name="//apple_ref/swift/Global/DDP_USER_DID_LOGOUT" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
20
LICENSE
20
LICENSE
|
@ -1,20 +0,0 @@
|
||||||
Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
"object": {
|
|
||||||
"pins": [
|
|
||||||
{
|
|
||||||
"package": "CryptoSwift",
|
|
||||||
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift.git",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "2bcb008fe23d286e5da79311051e19b3345f1cd5",
|
|
||||||
"version": "0.12.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"package": "SwiftWebSocket",
|
|
||||||
"repositoryURL": "https://github.com/tidwall/SwiftWebSocket.git",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "6567a9d2add5cf37674d4ed0fdd211efd57bd603",
|
|
||||||
"version": "2.7.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"package": "XCGLogger",
|
|
||||||
"repositoryURL": "https://github.com/DaveWoodCom/XCGLogger.git",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "1439885a7c6ac43cdec1bf96b83a0cbdb489244d",
|
|
||||||
"version": "6.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"version": 1
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
// swift-tools-version:4.2
|
|
||||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
|
||||||
|
|
||||||
import PackageDescription
|
|
||||||
|
|
||||||
let package = Package(
|
|
||||||
name: "SwiftDDP",
|
|
||||||
products: [
|
|
||||||
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
|
||||||
.library(
|
|
||||||
name: "SwiftDDP",
|
|
||||||
targets: ["SwiftDDP"]),
|
|
||||||
],
|
|
||||||
dependencies: [
|
|
||||||
// Dependencies declare other packages that this package depends on.
|
|
||||||
// .package(url: /* package url */, from: "1.0.0"),
|
|
||||||
.package(url: "https://github.com/DaveWoodCom/XCGLogger.git", from: "6.0.0"),
|
|
||||||
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "0.12.0"),
|
|
||||||
.package(url: "https://github.com/tidwall/SwiftWebSocket.git", from: "2.7.0"),
|
|
||||||
],
|
|
||||||
targets: [
|
|
||||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
|
||||||
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
|
|
||||||
.target(
|
|
||||||
name: "SwiftDDP",
|
|
||||||
dependencies: ["XCGLogger", "CryptoSwift", "SwiftWebSocket"],
|
|
||||||
path: "Sources"),
|
|
||||||
.testTarget(
|
|
||||||
name: "SwiftDDPTests",
|
|
||||||
dependencies: ["SwiftDDP"],
|
|
||||||
path: "SwiftDDPTests"),
|
|
||||||
]
|
|
||||||
)
|
|
|
@ -0,0 +1,190 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Protocols Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="js/jquery.min.js" defer></script>
|
||||||
|
<script src="js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a title="Protocols Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="img/carat.png" />
|
||||||
|
Protocols Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>Protocols</h1>
|
||||||
|
<p>The following protocols are available globally.</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:P8SwiftDDP16SwiftDDPDelegate"></a>
|
||||||
|
<a name="//apple_ref/swift/Protocol/SwiftDDPDelegate" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:P8SwiftDDP16SwiftDDPDelegate">SwiftDDPDelegate</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>DDPDelegate provides an interface to react to user events</p>
|
||||||
|
|
||||||
|
<a href="Protocols/SwiftDDPDelegate.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SwiftDDPDelegate</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:P8SwiftDDP20MeteorCollectionType"></a>
|
||||||
|
<a name="//apple_ref/swift/Protocol/MeteorCollectionType" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:P8SwiftDDP20MeteorCollectionType">MeteorCollectionType</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
<a href="Protocols/MeteorCollectionType.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,196 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>MeteorCollectionType Protocol Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Protocol/MeteorCollectionType" class="dashAnchor"></a>
|
||||||
|
<a title="MeteorCollectionType Protocol Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
MeteorCollectionType Protocol Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>MeteorCollectionType</h1>
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FP8SwiftDDP20MeteorCollectionType16documentWasAddedFTSS2idSS6fieldsGSqCSo12NSDictionary__T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasAdded(_:id:fields:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FP8SwiftDDP20MeteorCollectionType16documentWasAddedFTSS2idSS6fieldsGSqCSo12NSDictionary__T_">documentWasAdded(_:id:fields:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FP8SwiftDDP20MeteorCollectionType18documentWasChangedFTSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqGSaSS___T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasChanged(_:id:fields:cleared:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FP8SwiftDDP20MeteorCollectionType18documentWasChangedFTSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqGSaSS___T_">documentWasChanged(_:id:fields:cleared:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FP8SwiftDDP20MeteorCollectionType18documentWasRemovedFTSS2idSS_T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/documentWasRemoved(_:id:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FP8SwiftDDP20MeteorCollectionType18documentWasRemovedFTSS2idSS_T_">documentWasRemoved(_:id:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,199 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>SwiftDDPDelegate Protocol Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Protocol/SwiftDDPDelegate" class="dashAnchor"></a>
|
||||||
|
<a title="SwiftDDPDelegate Protocol Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
SwiftDDPDelegate Protocol Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>SwiftDDPDelegate</h1>
|
||||||
|
<div class="declaration">
|
||||||
|
<div class="language">
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SwiftDDPDelegate</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>DDPDelegate provides an interface to react to user events</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FP8SwiftDDP16SwiftDDPDelegate15ddpUserDidLoginFSST_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/ddpUserDidLogin(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FP8SwiftDDP16SwiftDDPDelegate15ddpUserDidLoginFSST_">ddpUserDidLogin(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SwiftDDPDelegate</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FP8SwiftDDP16SwiftDDPDelegate16ddpUserDidLogoutFSST_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/ddpUserDidLogout(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FP8SwiftDDP16SwiftDDPDelegate16ddpUserDidLogoutFSST_">ddpUserDidLogout(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SwiftDDPDelegate</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
367
README.md
367
README.md
|
@ -1,367 +0,0 @@
|
||||||
SwiftDDP <img src="https://github.com/siegesmund/SwiftDDP/blob/master/assets/logo.jpg" height="75" width="75"/>
|
|
||||||
=====
|
|
||||||
## A client for Meteor servers, written in Swift
|
|
||||||
### version 0.4.1
|
|
||||||
|
|
||||||
#### License
|
|
||||||
MIT
|
|
||||||
|
|
||||||
[](http://cocoapods.org/pods/SwiftDDP)
|
|
||||||
[](http://cocoapods.org/pods/SwiftDDP)
|
|
||||||
[](http://cocoapods.org/pods/SwiftDDP)
|
|
||||||
|
|
||||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
||||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
||||||
|
|
||||||
|
|
||||||
- [Installation](#installation)
|
|
||||||
- [Quick Start](#quick-start)
|
|
||||||
- [Setting basic configuration options](#setting-basic-configuration-options)
|
|
||||||
- [Connecting to a Meteor server](#connecting-to-a-meteor-server)
|
|
||||||
- [Login & Logout with password](#login-&-logout-with-password)
|
|
||||||
- [Subscribe to a subset of a collection](#subscribe-to-a-subset-of-a-collection)
|
|
||||||
- [Change the subscription's parameters and manage your subscription with unsubscribe](#change-the-subscriptions-parameters-and-manage-your-subscription-with-unsubscribe)
|
|
||||||
- [Call a method on the server](#call-a-method-on-the-server)
|
|
||||||
- [Simple in-memory persistence](#simple-in-memory-persistence)
|
|
||||||
- [Example: Creating an array based custom collection](#example-creating-an-array-based-custom-collection)
|
|
||||||
- [Changelog](#changelog)
|
|
||||||
- [0.3.2](#032)
|
|
||||||
- [0.3.1](#031)
|
|
||||||
- [0.3.0](#030)
|
|
||||||
- [0.2.2.1](#0221)
|
|
||||||
- [0.2.1](#021)
|
|
||||||
- [0.2.0](#020)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
|
|
||||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
With [CocoaPods](http://cocoapods.org). Add the following line to your Podfile:
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
pod "SwiftDDP", "~> 0.4.1"
|
|
||||||
```
|
|
||||||
|
|
||||||
With [Swift Package Manager](https://swift.org/package-manager/). Add the following line to the dependencies in your Package.swift:
|
|
||||||
|
|
||||||
```swift
|
|
||||||
.package(url: "https://github.com/y-ich/SwiftDDP.git", .branch("master")),
|
|
||||||
```
|
|
||||||
|
|
||||||
### Quick Start
|
|
||||||
|
|
||||||
#### Setting basic configuration options
|
|
||||||
```swift
|
|
||||||
import SwiftDDP
|
|
||||||
|
|
||||||
Meteor.client.allowSelfSignedSSL = true // Connect to a server that uses a self signed ssl certificate
|
|
||||||
Meteor.client.logLevel = .Info // Options are: .Verbose, .Debug, .Info, .Warning, .Error, .Severe, .None
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### Connecting to a Meteor server
|
|
||||||
|
|
||||||
```swift
|
|
||||||
|
|
||||||
// Meteor.connect will automatically connect and will sign in using
|
|
||||||
// a stored login token if the client was previously signed in.
|
|
||||||
|
|
||||||
Meteor.connect("wss://todos.meteor.com/websocket") {
|
|
||||||
// do something after the client connects
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Login & Logout with password
|
|
||||||
|
|
||||||
Login using email and password.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
Meteor.loginWithPassword("user@swiftddp.com", password: "********") { result, error in
|
|
||||||
// do something after login
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Login using username and password.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
Meteor.loginWithUsername("swiftddp", password: "********") { result, error in
|
|
||||||
// do something after login
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Log out.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
Meteor.logout() { result, error in
|
|
||||||
// do something after logout
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
The client also posts a notification when the user signs in and signs out, and during connection failure events.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
// Notification name (a string global variable)
|
|
||||||
DDP_USER_DID_LOGIN
|
|
||||||
DDP_USER_DID_LOGOUT
|
|
||||||
//Websocket/DDP connection failure events
|
|
||||||
DDP_WEBSOCKET_CLOSE
|
|
||||||
DDP_WEBSOCKET_ERROR
|
|
||||||
DDP_DISCONNECTED
|
|
||||||
DDP_FAILED
|
|
||||||
|
|
||||||
// Example
|
|
||||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "userDidLogin", name: DDP_USER_DID_LOGIN, object: nil)
|
|
||||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "userDidLogout", name: DDP_USER_DID_LOGOUT, object: nil)
|
|
||||||
|
|
||||||
func userDidLogin() {
|
|
||||||
print("The user just signed in!")
|
|
||||||
}
|
|
||||||
|
|
||||||
func userDidLogout() {
|
|
||||||
print("The user just signed out!")
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Subscribe to a subset of a collection
|
|
||||||
|
|
||||||
```swift
|
|
||||||
Meteor.subscribe("todos")
|
|
||||||
|
|
||||||
Meteor.subscribe("todos") {
|
|
||||||
// Do something when the todos subscription is ready
|
|
||||||
}
|
|
||||||
|
|
||||||
Meteor.subscribe("todos", [1,2,3,4]) {
|
|
||||||
// Do something when the todos subscription is ready
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Change the subscription's parameters and manage your subscription with unsubscribe
|
|
||||||
```swift
|
|
||||||
|
|
||||||
// Suppose you want to subscribe to a list of all cities and towns near a specific major city
|
|
||||||
|
|
||||||
// Subscribe to cities near Boston
|
|
||||||
let id1 = Meteor.subscribe("cities", ["lat": 42.358056 ,"lon": -71.063611]) {
|
|
||||||
// You are now subscribed to cities associated with the coordinates 42.358056, -71.063611
|
|
||||||
// id1 contains a key that allows you to cancel the subscription associated with
|
|
||||||
// the parameters ["lat": 42.358056 ,"lon": -71.063611]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subscribe to cities near Paris
|
|
||||||
let id2 = Meteor.subscribe("cities", ["lat": 48.8567, "lon": 2.3508]){
|
|
||||||
// You are now subscribed to cities associated with the coordinates 48.8567, 2.3508
|
|
||||||
// id2 contains a key that allows you to cancel the subscription associated with
|
|
||||||
// the parameters ["lat": 48.8567 ,"lon": 2.3508]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subscribe to cities near New York
|
|
||||||
let id3 = Meteor.subscribe("cities", ["lat": 40.7127, "lon": -74.0059]){
|
|
||||||
// You are now subscribed to cities associated with the coordinates 40.7127, -74.0059
|
|
||||||
// id3 contains a key that allows you to cancel the subscription associated with
|
|
||||||
// the parameters ["lat": 40.7127 ,"lon": -74.0059]
|
|
||||||
}
|
|
||||||
|
|
||||||
// When these subscriptions have completed, the collection associated with "cities" will now contain all
|
|
||||||
// documents returned from the three subscriptions
|
|
||||||
|
|
||||||
Meteor.unsubscribe(withId: id2)
|
|
||||||
// Your collection will now contain cities near Boston and New York, but not Paris
|
|
||||||
Meteor.unsubscribe("cities")
|
|
||||||
// You are now unsubscribed to all subscriptions associated with the publication "cities"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Call a method on the server
|
|
||||||
|
|
||||||
```swift
|
|
||||||
Meteor.call("foo", [1, 2, 3, 4]) { result, error in
|
|
||||||
// Do something with the method result
|
|
||||||
}
|
|
||||||
```
|
|
||||||
When passing parameters to a server method, the parameters object must be serializable with NSJSONSerialization
|
|
||||||
|
|
||||||
#### Simple in-memory persistence
|
|
||||||
SwiftDDP includes a class called MeteorCollection that provides simple, ephemeral dictionary backed persistence. MeteorCollection stores objects subclassed from MeteorDocument. Creating a collection is as simple as:
|
|
||||||
|
|
||||||
```swift
|
|
||||||
class List: MeteorDocument {
|
|
||||||
|
|
||||||
var collection:String = "lists"
|
|
||||||
var name:String?
|
|
||||||
var userId:String?
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
let lists = MeteorCollection<List>(name: "lists") // As with Meteorjs, the name is the name of the server-side collection
|
|
||||||
Meteor.subscribe("lists")
|
|
||||||
```
|
|
||||||
For client side insertions, updates and removals:
|
|
||||||
|
|
||||||
```swift
|
|
||||||
let list = List(id: Meteor.client.getId(), fields: ["name": "foo"])
|
|
||||||
|
|
||||||
// Insert the object on both the client and server.
|
|
||||||
lists.insert(list)
|
|
||||||
|
|
||||||
// Update the object on both the client and server
|
|
||||||
list.name = "bar"
|
|
||||||
lists.update(list)
|
|
||||||
|
|
||||||
// Remove the object on both the client and server
|
|
||||||
lists.remove(list)
|
|
||||||
```
|
|
||||||
For each operation the action is executed on the client, and rolled back if the server returns an error.
|
|
||||||
|
|
||||||
#### Tips for CLI
|
|
||||||
|
|
||||||
If you make a command line tool, you need to call the function dispatchMain in main thread after proper DDP settings. Otherwise, you will encounter a dead lock.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
|
|
||||||
Meteor.connect("wss://todos.meteor.com/websocket") {
|
|
||||||
// do something after the client connects
|
|
||||||
}
|
|
||||||
dispatchMain()
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Example: Creating an array based custom collection
|
|
||||||
**The following pattern can be used to create custom collections backed by any datastore**
|
|
||||||
|
|
||||||
In this example, we'll create a simple collection to hold a list of contacts. The first thing we'll do is create an object to represent a contact. This object has four properties and a method named *update* that maps the *fields* NSDictionary to the struct's properties. *Update* is called when an object is created and when an update is performed. Meteor will always transmit an **id** to identify the object that should be added, updated or removed, so objects that represent Meteor documents must **always** have an id field. Here we're sticking to the MongoDB convention of naming our id *_id*.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
|
|
||||||
struct Contact {
|
|
||||||
|
|
||||||
var _id:String?
|
|
||||||
var name:String?
|
|
||||||
var phone:String?
|
|
||||||
var email:String?
|
|
||||||
|
|
||||||
init(id:String, fields:NSDictionary?) {
|
|
||||||
self._id = id
|
|
||||||
update(fields)
|
|
||||||
}
|
|
||||||
|
|
||||||
mutating func update(fields:NSDictionary?) {
|
|
||||||
|
|
||||||
if let name = fields?.valueForKey("name") as? String {
|
|
||||||
self.name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
if let phone = fields?.valueForKey("phone") as? String {
|
|
||||||
self.phone = phone
|
|
||||||
}
|
|
||||||
|
|
||||||
if let email = fields?.valueForKey("email") as? String {
|
|
||||||
self.email = email
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
Next, we'll create the collection class that will hold our contacts and provide the logic to respond to server-side changes to the documents and the subscription set. SwiftDDP contains an abstract class called AbstractCollection that can be used to build custom collections. Subclassing AbstractCollection allows you to override three methods that are called in response to events on the server: *documentWasAdded*, *documentWasChanged* and *documentWasRemoved*.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
class UserCollection: AbstractCollection {
|
|
||||||
|
|
||||||
var contacts = [Contact]()
|
|
||||||
|
|
||||||
// Include any logic that needs to occur when a document is added to the collection on the server
|
|
||||||
override public func documentWasAdded(collection:String, id:String, fields:NSDictionary?) {
|
|
||||||
let user = User(id, fields)
|
|
||||||
users.append(user)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include any logic that needs to occur when a document is changed on the server
|
|
||||||
override public func documentWasChanged(collection:String, id:String, fields:NSDictionary?, cleared:[String]?) {
|
|
||||||
if let index = contacts.indexOf({ contact in return contact._id == id }) {
|
|
||||||
contact = contacts[index]
|
|
||||||
contact.update(fields)
|
|
||||||
contacts[index] = contact
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include any logic that needs to occur when a document is removed on the server
|
|
||||||
override public func documentWasRemoved(collection:String, id:String) {
|
|
||||||
if let index = contacts.indexOf({ contact in return contact._id == id }) {
|
|
||||||
contacts[index] = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
So far, we're able to process documents that have been added, changed or removed on the server. But the UserCollection class still lacks the ability to make changes to both the local datastore and on the server. We'll change that. In the UserCollection class, create a method called insert.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
class UserCollection: AbstractCollection {
|
|
||||||
/*
|
|
||||||
override public func documentWasAdded ...
|
|
||||||
override public func documentWasChanged ...
|
|
||||||
override public func documentWasRemoved ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func insert(contact: Contact) {
|
|
||||||
|
|
||||||
// (1) save the document to the contacts array
|
|
||||||
contacts[contacts._id] = contact
|
|
||||||
|
|
||||||
// (2) now try to insert the document on the server
|
|
||||||
client.insert(self.name, document: [contacts.fields()]) { result, error in
|
|
||||||
|
|
||||||
// (3) However, if the server returns an error, reverse the action on the client by
|
|
||||||
// removing the document from the contacts collection
|
|
||||||
if error != nil {
|
|
||||||
self.contacts[contact._id] = nil
|
|
||||||
log.error("\(error!)")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
The key parts of this method are:
|
|
||||||
- (1) save the new contact to the array we created in UserCollection
|
|
||||||
- (2) invoke client.insert to initiate an insert on the server
|
|
||||||
- (3) remove the contact from the local store if the server rejects the insert
|
|
||||||
|
|
||||||
Creating update and remove methods are also easy to create, and follow the same patern as insert. For a more extensive example of the patterns shown here, have a look at [MeteorCollection.swift](https://github.com/siegesmund/SwiftDDP/blob/master/SwiftDDP/MeteorCollection.swift). MeteorCollection is an in-memory collection implementation suitable for simple applications.
|
|
||||||
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
### 0.4.0
|
|
||||||
- Updated to Swift 3.0
|
|
||||||
|
|
||||||
### 0.3.2
|
|
||||||
- Bugfixes
|
|
||||||
|
|
||||||
### 0.3.1
|
|
||||||
- Bug fixed that affected DDP dates in 32 bit environments
|
|
||||||
|
|
||||||
### 0.3.0
|
|
||||||
- Changed default subscription behavior
|
|
||||||
- Added a method to sign a user in via username
|
|
||||||
|
|
||||||
**Version 0.3.0 contains breaking changes**
|
|
||||||
- You can now update a subscription by changing its parameters without first unsubscribing. This will subscribe the client to any documents associated with the new subscription and parameters. When you pass a new set of parameters to a subscription that you have previously subscribed to, you remain subscribed to any documents associated with that prior subscription.
|
|
||||||
- The subscription method returns an id. To unsubscribe to documents associated with a specific set of parameters, you must unsubscribe with this id.
|
|
||||||
- Unsubscribing by name now works differently. When unsubscribing by name, you unsubscribe to any and all subscriptions with that name.
|
|
||||||
- You can no longer pass a callback to ``unsubscribe(name:String)``. It now returns an array with the ids of the subscriptions you've unsubscribed to.
|
|
||||||
|
|
||||||
### 0.2.2.1
|
|
||||||
|
|
||||||
- Improved subscription handling across app states
|
|
||||||
- Dependencies updated for Swift 2.2
|
|
||||||
|
|
||||||
### 0.2.1
|
|
||||||
- Reconnection behavior improvements: reconnect attempts now follow an exponential backoff pattern
|
|
||||||
- Client now connects to servers using self signed SSL certificates when allowSelfSignedSSL is set to true
|
|
||||||
- The loglevel can now be set directly using the logLevel property on the client. The default setting is .None
|
|
||||||
|
|
||||||
### 0.2.0
|
|
||||||
- Integration with Meteor's Facebook, Twitter & other login services
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
Pull requests, feature requests are feedback are welcome. If you're using SwiftDDP in a production app, let us know.
|
|
|
@ -1,68 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
open class AbstractCollection: NSObject, MeteorCollectionType {
|
|
||||||
|
|
||||||
open var name:String
|
|
||||||
open let client = Meteor.client
|
|
||||||
|
|
||||||
public init(name:String) {
|
|
||||||
self.name = name
|
|
||||||
super.init()
|
|
||||||
Meteor.collections[name] = self
|
|
||||||
}
|
|
||||||
|
|
||||||
deinit {
|
|
||||||
Meteor.collections[name] = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Invoked when a document has been sent from the server.
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
- parameter fields: an optional NSDictionary with the documents properties
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func documentWasAdded(_ collection:String, id:String, fields:NSDictionary?) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Invoked when a document has been changed on the server.
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
- parameter fields: an optional NSDictionary with the documents properties
|
|
||||||
- parameter cleared: Optional array of strings (field names to delete)
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func documentWasChanged(_ collection:String, id:String, fields:NSDictionary?, cleared:[String]?) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Invoked when a document has been removed on the server.
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func documentWasRemoved(_ collection:String, id:String) {}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,611 +0,0 @@
|
||||||
//
|
|
||||||
//
|
|
||||||
// A DDP Client written in Swift
|
|
||||||
//
|
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
//
|
|
||||||
// This software uses CryptoSwift: https://github.com/krzyzanowskim/CryptoSwift/
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import SwiftWebSocket
|
|
||||||
import XCGLogger
|
|
||||||
|
|
||||||
let log = XCGLogger(identifier: "DDP")
|
|
||||||
|
|
||||||
public typealias DDPMethodCallback = (_ result:Any?, _ error:DDPError?) -> ()
|
|
||||||
public typealias DDPConnectedCallback = (_ session:String) -> ()
|
|
||||||
public typealias DDPCallback = () -> ()
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
DDPDelegate provides an interface to react to user events
|
|
||||||
*/
|
|
||||||
|
|
||||||
public protocol SwiftDDPDelegate {
|
|
||||||
func ddpUserDidLogin(_ user:String)
|
|
||||||
func ddpUserDidLogout(_ user:String)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
DDPClient is the base class for communicating with a server using the DDP protocol
|
|
||||||
*/
|
|
||||||
|
|
||||||
open class DDPClient: NSObject {
|
|
||||||
|
|
||||||
// included for storing login id and token
|
|
||||||
internal let userData = UserDefaults.standard
|
|
||||||
|
|
||||||
let background: OperationQueue = {
|
|
||||||
let queue = OperationQueue()
|
|
||||||
queue.name = "DDP Background Data Queue"
|
|
||||||
queue.qualityOfService = .background
|
|
||||||
return queue
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Callbacks execute in the order they're received
|
|
||||||
internal let callbackQueue: OperationQueue = {
|
|
||||||
let queue = OperationQueue()
|
|
||||||
queue.name = "DDP Callback Queue"
|
|
||||||
queue.maxConcurrentOperationCount = 1
|
|
||||||
queue.qualityOfService = .userInitiated
|
|
||||||
return queue
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Document messages are processed in the order that they are received,
|
|
||||||
// separately from callbacks
|
|
||||||
internal let documentQueue: OperationQueue = {
|
|
||||||
let queue = OperationQueue()
|
|
||||||
queue.name = "DDP Background Queue"
|
|
||||||
queue.maxConcurrentOperationCount = 1
|
|
||||||
queue.qualityOfService = .background
|
|
||||||
return queue
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Hearbeats get a special queue so that they're not blocked by
|
|
||||||
// other operations, causing the connection to close
|
|
||||||
internal let heartbeat: OperationQueue = {
|
|
||||||
let queue = OperationQueue()
|
|
||||||
queue.name = "DDP Heartbeat Queue"
|
|
||||||
queue.qualityOfService = .utility
|
|
||||||
return queue
|
|
||||||
}()
|
|
||||||
|
|
||||||
let userBackground: OperationQueue = {
|
|
||||||
let queue = OperationQueue()
|
|
||||||
queue.name = "DDP High Priority Background Queue"
|
|
||||||
queue.qualityOfService = .userInitiated
|
|
||||||
return queue
|
|
||||||
}()
|
|
||||||
|
|
||||||
let userMainQueue: OperationQueue = {
|
|
||||||
let queue = OperationQueue.main
|
|
||||||
queue.name = "DDP High Priorty Main Queue"
|
|
||||||
queue.qualityOfService = .userInitiated
|
|
||||||
return queue
|
|
||||||
}()
|
|
||||||
|
|
||||||
fileprivate var socket:WebSocket!{
|
|
||||||
didSet{ socket.allowSelfSignedSSL = self.allowSelfSignedSSL }
|
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate var server:(ping:Date?, pong:Date?) = (nil, nil)
|
|
||||||
|
|
||||||
internal var resultCallbacks:[String:Completion] = [:]
|
|
||||||
internal var subCallbacks:[String:Completion] = [:]
|
|
||||||
internal var unsubCallbacks:[String:Completion] = [:]
|
|
||||||
|
|
||||||
open var url:String!
|
|
||||||
fileprivate var subscriptions = [String:(id:String, name:String, ready:Bool)]()
|
|
||||||
|
|
||||||
internal var events = DDPEvents()
|
|
||||||
internal var connection:(ddp:Bool, session:String?) = (false, nil)
|
|
||||||
|
|
||||||
open var delegate:SwiftDDPDelegate?
|
|
||||||
|
|
||||||
|
|
||||||
// MARK: Settings
|
|
||||||
|
|
||||||
/**
|
|
||||||
Boolean value that determines whether the
|
|
||||||
*/
|
|
||||||
|
|
||||||
open var allowSelfSignedSSL:Bool = false {
|
|
||||||
didSet{
|
|
||||||
guard let currentSocket = socket else { return }
|
|
||||||
currentSocket.allowSelfSignedSSL = allowSelfSignedSSL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sets the log level. The default value is .None.
|
|
||||||
Possible values: .Verbose, .Debug, .Info, .Warning, .Error, .Severe, .None
|
|
||||||
*/
|
|
||||||
|
|
||||||
open var logLevel = XCGLogger.Level.none {
|
|
||||||
didSet {
|
|
||||||
log.setup(level: logLevel, showLogIdentifier: true, showFunctionName: true, showThreadName: true, showLevel: true, showFileNames: false, showLineNumbers: true, showDate: false, writeToFile: nil, fileLevel: .none)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override init() {
|
|
||||||
super.init()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a random String id
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func getId() -> String {
|
|
||||||
let numbers = Set<Character>(["0","1","2","3","4","5","6","7","8","9"])
|
|
||||||
let uuid = UUID().uuidString.replacingOccurrences(of: "-", with: "")
|
|
||||||
var id = ""
|
|
||||||
for character in uuid.characters {
|
|
||||||
if (!numbers.contains(character) && (round(Float(arc4random()) / Float(UINT32_MAX)) == 1)) {
|
|
||||||
id += String(character).lowercased()
|
|
||||||
} else {
|
|
||||||
id += String(character)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Makes a DDP connection to the server
|
|
||||||
|
|
||||||
- parameter url: The String url to connect to, ex. "wss://todos.meteor.com/websocket"
|
|
||||||
- parameter callback: A closure that takes a String argument with the value of the websocket session token
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func connect(_ url:String, callback:DDPConnectedCallback?) {
|
|
||||||
self.url = url
|
|
||||||
// capture the thread context in which the function is called
|
|
||||||
let executionQueue = OperationQueue.current
|
|
||||||
|
|
||||||
socket = WebSocket(url)
|
|
||||||
//Create backoff
|
|
||||||
let backOff:DDPExponentialBackoff = DDPExponentialBackoff()
|
|
||||||
|
|
||||||
socket.event.close = {code, reason, clean in
|
|
||||||
//Use backoff to slow reconnection retries
|
|
||||||
backOff.createBackoff({
|
|
||||||
log.info("Web socket connection closed with code \(code). Clean: \(clean). \(reason)")
|
|
||||||
let event = self.socket.event
|
|
||||||
self.socket = WebSocket(url)
|
|
||||||
self.socket.event = event
|
|
||||||
self.ping()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.event.error = events.onWebsocketError
|
|
||||||
|
|
||||||
socket.event.open = {
|
|
||||||
self.heartbeat.addOperation() {
|
|
||||||
|
|
||||||
// Add a subscription to loginServices to each connection event
|
|
||||||
let callbackWithServiceConfiguration = { (session:String) in
|
|
||||||
|
|
||||||
|
|
||||||
// let loginServicesSubscriptionCollection = "meteor_accounts_loginServiceConfiguration"
|
|
||||||
let loginServiceConfiguration = "meteor.loginServiceConfiguration"
|
|
||||||
self.sub(loginServiceConfiguration, params: nil) // /tools/meteor-services/auth.js line 922
|
|
||||||
|
|
||||||
|
|
||||||
// Resubscribe to existing subs on connection to ensure continuity
|
|
||||||
self.subscriptions.forEach({ (subscription: (String, (id: String, name: String, ready: Bool))) -> () in
|
|
||||||
if subscription.1.name != loginServiceConfiguration {
|
|
||||||
self.sub(subscription.1.id, name: subscription.1.name, params: nil, callback: nil)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
callback?(session)
|
|
||||||
}
|
|
||||||
|
|
||||||
var completion = Completion(connectedCallback: callbackWithServiceConfiguration)
|
|
||||||
//Reset the backoff to original values
|
|
||||||
backOff.reset()
|
|
||||||
completion.executionQueue = executionQueue
|
|
||||||
self.events.onConnected = completion
|
|
||||||
self.sendMessage(["msg":"connect", "version":"1", "support":["1"]])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.event.message = { message in
|
|
||||||
self.background.addOperation() {
|
|
||||||
if let text = message as? String {
|
|
||||||
do { try self.ddpMessageHandler(DDPMessage(message: text)) }
|
|
||||||
catch { log.debug("Message handling error. Raw message: \(text)")}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate func ping() {
|
|
||||||
heartbeat.addOperation() {
|
|
||||||
self.sendMessage(["msg":"ping", "id":self.getId()])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Respond to a server ping
|
|
||||||
fileprivate func pong(_ ping: DDPMessage) {
|
|
||||||
heartbeat.addOperation() {
|
|
||||||
self.server.ping = Date()
|
|
||||||
var response = ["msg":"pong"]
|
|
||||||
if let id = ping.id { response["id"] = id }
|
|
||||||
self.sendMessage(response as NSDictionary)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse DDP messages and dispatch to the appropriate function
|
|
||||||
internal func ddpMessageHandler(_ message: DDPMessage) throws {
|
|
||||||
|
|
||||||
log.debug("Received message: \(message.json)")
|
|
||||||
|
|
||||||
switch message.type {
|
|
||||||
|
|
||||||
case .Connected:
|
|
||||||
self.connection = (true, message.session!)
|
|
||||||
self.events.onConnected.execute(message.session!)
|
|
||||||
|
|
||||||
case .Result: callbackQueue.addOperation() {
|
|
||||||
if let id = message.id, // Message has id
|
|
||||||
let completion = self.resultCallbacks[id], // There is a callback registered for the message
|
|
||||||
let result = message.result {
|
|
||||||
completion.execute(result, error: message.error)
|
|
||||||
self.resultCallbacks[id] = nil
|
|
||||||
} else if let id = message.id,
|
|
||||||
let completion = self.resultCallbacks[id] {
|
|
||||||
completion.execute(nil, error:message.error)
|
|
||||||
self.resultCallbacks[id] = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Principal callbacks for managing data
|
|
||||||
// Document was added
|
|
||||||
case .Added: documentQueue.addOperation() {
|
|
||||||
if let collection = message.collection,
|
|
||||||
let id = message.id {
|
|
||||||
self.documentWasAdded(collection, id: id, fields: message.fields)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Document was changed
|
|
||||||
case .Changed: documentQueue.addOperation() {
|
|
||||||
if let collection = message.collection,
|
|
||||||
let id = message.id {
|
|
||||||
self.documentWasChanged(collection, id: id, fields: message.fields, cleared: message.cleared)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Document was removed
|
|
||||||
case .Removed: documentQueue.addOperation() {
|
|
||||||
if let collection = message.collection,
|
|
||||||
let id = message.id {
|
|
||||||
self.documentWasRemoved(collection, id: id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notifies you when the result of a method changes
|
|
||||||
case .Updated: documentQueue.addOperation() {
|
|
||||||
if let methods = message.methods {
|
|
||||||
self.methodWasUpdated(methods)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callbacks for managing subscriptions
|
|
||||||
case .Ready: documentQueue.addOperation() {
|
|
||||||
if let subs = message.subs {
|
|
||||||
self.ready(subs)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback that fires when subscription has been completely removed
|
|
||||||
//
|
|
||||||
case .Nosub: documentQueue.addOperation() {
|
|
||||||
if let id = message.id {
|
|
||||||
self.nosub(id, error: message.error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case .Ping: heartbeat.addOperation() { self.pong(message) }
|
|
||||||
|
|
||||||
case .Pong: heartbeat.addOperation() { self.server.pong = Date() }
|
|
||||||
|
|
||||||
case .Error: background.addOperation() {
|
|
||||||
self.didReceiveErrorMessage(DDPError(json: message.json))
|
|
||||||
}
|
|
||||||
|
|
||||||
default: log.error("Unhandled message: \(message.json)")
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate func sendMessage(_ message:NSDictionary) {
|
|
||||||
if let m = message.stringValue() {
|
|
||||||
self.socket.send(m)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Executes a method on the server. If a callback is passed, the callback is asynchronously
|
|
||||||
executed when the method has completed. The callback takes two arguments: result and error. It
|
|
||||||
the method call is successful, result contains the return value of the method, if any. If the method fails,
|
|
||||||
error contains information about the error.
|
|
||||||
|
|
||||||
- parameter name: The name of the method
|
|
||||||
- parameter params: An object containing method arguments, if any
|
|
||||||
- parameter callback: The closure to be executed when the method has been executed
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult open func method(_ name: String, params: Any?, callback: DDPMethodCallback?) -> String {
|
|
||||||
let id = getId()
|
|
||||||
let message = ["msg":"method", "method":name, "id":id] as NSMutableDictionary
|
|
||||||
if let p = params { message["params"] = p }
|
|
||||||
|
|
||||||
if let completionCallback = callback {
|
|
||||||
let completion = Completion(methodCallback: completionCallback)
|
|
||||||
self.resultCallbacks[id] = completion
|
|
||||||
}
|
|
||||||
|
|
||||||
userBackground.addOperation() {
|
|
||||||
self.sendMessage(message)
|
|
||||||
}
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Subscribe
|
|
||||||
//
|
|
||||||
|
|
||||||
@discardableResult internal func sub(_ id: String, name: String, params: [Any]?, callback: DDPCallback?) -> String {
|
|
||||||
|
|
||||||
if let completionCallback = callback {
|
|
||||||
let completion = Completion(callback: completionCallback)
|
|
||||||
self.subCallbacks[id] = completion
|
|
||||||
}
|
|
||||||
|
|
||||||
self.subscriptions[id] = (id, name, false)
|
|
||||||
let message = ["msg":"sub", "name":name, "id":id] as NSMutableDictionary
|
|
||||||
if let p = params { message["params"] = p }
|
|
||||||
userBackground.addOperation() {
|
|
||||||
[weak self] in
|
|
||||||
|
|
||||||
if let strongSelf = self
|
|
||||||
{
|
|
||||||
strongSelf.sendMessage(message)
|
|
||||||
} else {
|
|
||||||
log.error("Ignored message - client was already destroyed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription
|
|
||||||
- parameter params: An object containing method arguments, if any
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult open func sub(_ name: String, params: [Any]?) -> String {
|
|
||||||
let id = getId()
|
|
||||||
return sub(id, name: name, params: params, callback:nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server. If a callback is passed, the callback asynchronously
|
|
||||||
runs when the client receives a 'ready' message indicating that the initial subset of documents contained
|
|
||||||
in the subscription has been sent by the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription
|
|
||||||
- parameter params: An object containing method arguments, if any
|
|
||||||
- parameter callback: The closure to be executed when the server sends a 'ready' message
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func sub(_ name:String, params: [Any]?, callback: DDPCallback?) -> String {
|
|
||||||
let id = getId()
|
|
||||||
log.info("Subscribing to ID \(id)")
|
|
||||||
return sub(id, name: name, params: params, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterates over the Dictionary of subscriptions to find a subscription by name
|
|
||||||
internal func findSubscription(_ name:String) -> [String] {
|
|
||||||
var subs:[String] = []
|
|
||||||
for sub in subscriptions.values {
|
|
||||||
if sub.name == name {
|
|
||||||
subs.append(sub.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return subs
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterates over the Dictionary of subscriptions to find a subscription by name
|
|
||||||
internal func subscriptionReady(_ name:String) -> Bool {
|
|
||||||
for sub in subscriptions.values {
|
|
||||||
if sub.name == name {
|
|
||||||
return sub.ready
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Unsubscribe
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends an unsubscribe request to the server.
|
|
||||||
- parameter name: The name of the subscription
|
|
||||||
- parameter callback: The closure to be executed when the server sends a 'ready' message
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func unsub(withName name: String, callback: DDPCallback?) -> [String] {
|
|
||||||
|
|
||||||
let unsubgroup = DispatchGroup()
|
|
||||||
|
|
||||||
let unsub_ids = findSubscription(name).map({id -> (String) in
|
|
||||||
unsubgroup.enter()
|
|
||||||
unsub(withId: id){
|
|
||||||
unsubgroup.leave()
|
|
||||||
}
|
|
||||||
return id
|
|
||||||
})
|
|
||||||
|
|
||||||
if let completionCallback = callback {
|
|
||||||
unsubgroup.notify(queue: DispatchQueue.main, execute: completionCallback)
|
|
||||||
}
|
|
||||||
|
|
||||||
return unsub_ids
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends an unsubscribe request to the server. If a callback is passed, the callback asynchronously
|
|
||||||
runs when the client receives a 'ready' message indicating that the subset of documents contained
|
|
||||||
in the subscription have been removed.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription
|
|
||||||
- parameter callback: The closure to be executed when the server sends a 'ready' message
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func unsub(withId id: String, callback: DDPCallback?) {
|
|
||||||
if let completionCallback = callback {
|
|
||||||
let completion = Completion(callback: completionCallback)
|
|
||||||
unsubCallbacks[id] = completion
|
|
||||||
}
|
|
||||||
background.addOperation() { self.sendMessage(["msg":"unsub", "id":id]) }
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Responding to server subscription messages
|
|
||||||
//
|
|
||||||
|
|
||||||
fileprivate func ready(_ subs: [String]) {
|
|
||||||
for id in subs {
|
|
||||||
if let completion = subCallbacks[id] {
|
|
||||||
completion.execute() // Run the callback
|
|
||||||
subCallbacks[id] = nil // Delete the callback after running
|
|
||||||
} else { // If there is no callback, execute the method
|
|
||||||
if var sub = subscriptions[id] {
|
|
||||||
sub.ready = true
|
|
||||||
subscriptions[id] = sub
|
|
||||||
subscriptionIsReady(sub.id, subscriptionName: sub.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate func nosub(_ id: String, error: DDPError?) {
|
|
||||||
if let e = error, (e.isValid == true) {
|
|
||||||
log.error("\(e)")
|
|
||||||
} else {
|
|
||||||
if let completion = unsubCallbacks[id],
|
|
||||||
let _ = subscriptions[id] {
|
|
||||||
completion.execute()
|
|
||||||
unsubCallbacks[id] = nil
|
|
||||||
subscriptions[id] = nil
|
|
||||||
} else {
|
|
||||||
if let subscription = subscriptions[id] {
|
|
||||||
subscriptions[id] = nil
|
|
||||||
subscriptionWasRemoved(subscription.id, subscriptionName: subscription.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// public callbacks: should be overridden
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
Executes when a subscription is ready.
|
|
||||||
|
|
||||||
- parameter subscriptionId: A String representation of the hash of the subscription name
|
|
||||||
- parameter subscriptionName: The name of the subscription
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func subscriptionIsReady(_ subscriptionId: String, subscriptionName:String) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Executes when a subscription is removed.
|
|
||||||
|
|
||||||
- parameter subscriptionId: A String representation of the hash of the subscription name
|
|
||||||
- parameter subscriptionName: The name of the subscription
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func subscriptionWasRemoved(_ subscriptionId:String, subscriptionName:String) {}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Executes when the server has sent a new document.
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection that the document belongs to
|
|
||||||
- parameter id: The document's unique id
|
|
||||||
- parameter fields: The documents properties
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func documentWasAdded(_ collection:String, id:String, fields:NSDictionary?) {
|
|
||||||
if let added = events.onAdded { added(collection, id, fields) }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Executes when the server sends a message to remove a document.
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection that the document belongs to
|
|
||||||
- parameter id: The document's unique id
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func documentWasRemoved(_ collection:String, id:String) {
|
|
||||||
if let removed = events.onRemoved { removed(collection, id) }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Executes when the server sends a message to update a document.
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection that the document belongs to
|
|
||||||
- parameter id: The document's unique id
|
|
||||||
- parameter fields: Optional object with EJSON values containing the fields to update
|
|
||||||
- parameter cleared: Optional array of strings (field names to delete)
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func documentWasChanged(_ collection:String, id:String, fields:NSDictionary?, cleared:[String]?) {
|
|
||||||
if let changed = events.onChanged { changed(collection, id, fields, cleared as NSArray?) }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Executes when the server sends a message indicating that the result of a method has changed.
|
|
||||||
|
|
||||||
- parameter methods: An array of strings (ids passed to 'method', all of whose writes have been reflected in data messages)
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func methodWasUpdated(_ methods:[String]) {
|
|
||||||
if let updated = events.onUpdated { updated(methods) }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Executes when the client receives an error message from the server. Such a message is used to represent errors raised by the method or subscription, as well as an attempt to subscribe to an unknown subscription or call an unknown method.
|
|
||||||
|
|
||||||
- parameter message: A DDPError object with information about the error
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func didReceiveErrorMessage(_ message: DDPError) {
|
|
||||||
if let error = events.onError { error(message) }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
/**
|
|
||||||
Completion is a wrapper for DDP callbacks that ensures that callbacks are executed
|
|
||||||
on the same queue on which the original method was called. If the current queue is
|
|
||||||
not available, execution defaults to the main queue.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public struct Completion {
|
|
||||||
|
|
||||||
var executionQueue:OperationQueue? = OperationQueue.current
|
|
||||||
var methodCallback:DDPMethodCallback?
|
|
||||||
var connectedCallback:DDPConnectedCallback?
|
|
||||||
var callback:DDPCallback?
|
|
||||||
|
|
||||||
init(methodCallback:@escaping DDPMethodCallback) {
|
|
||||||
self.methodCallback = methodCallback
|
|
||||||
}
|
|
||||||
|
|
||||||
init(connectedCallback:@escaping DDPConnectedCallback) {
|
|
||||||
self.connectedCallback = connectedCallback
|
|
||||||
}
|
|
||||||
|
|
||||||
init(callback:@escaping DDPCallback) {
|
|
||||||
self.callback = callback
|
|
||||||
}
|
|
||||||
|
|
||||||
func execute(_ result:Any?, error:DDPError?) {
|
|
||||||
|
|
||||||
if let callback = methodCallback {
|
|
||||||
if let queue = executionQueue {
|
|
||||||
queue.addOperation() {
|
|
||||||
callback(result, error)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
OperationQueue.main.addOperation() {
|
|
||||||
callback(result, error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func execute(_ session:String) {
|
|
||||||
|
|
||||||
if let callback = connectedCallback {
|
|
||||||
if let queue = executionQueue {
|
|
||||||
queue.addOperation() {
|
|
||||||
callback(session)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
OperationQueue.main.addOperation() {
|
|
||||||
callback(session)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func execute() {
|
|
||||||
|
|
||||||
if let callback = self.callback {
|
|
||||||
if let queue = executionQueue {
|
|
||||||
queue.addOperation() {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
OperationQueue.main.addOperation() {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,141 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
/**
|
|
||||||
DDPEvents is a struct holder for callback closures that execute in response to
|
|
||||||
websocket and Meteor lifecyle events. New closures can be assigned to public
|
|
||||||
closures to modify the clients behavior in response to the trigger event.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public let DDP_WEBSOCKET_CLOSE = "DDP_WEBSOCKET_CLOSE"
|
|
||||||
public let DDP_WEBSOCKET_ERROR = "DDP_WEBSOCKET_ERROR"
|
|
||||||
public let DDP_DISCONNECTED = "DDP_DISCONNECTED"
|
|
||||||
public let DDP_FAILED = "DDP_FAILED"
|
|
||||||
|
|
||||||
public struct DDPEvents {
|
|
||||||
|
|
||||||
/**
|
|
||||||
onWebsocketClose executes when the websocket connection has closed
|
|
||||||
|
|
||||||
- parameter code: An integer value that provides the reason code for closing the websocket connection
|
|
||||||
- parameter reason: A string describing the reason that the websocket was closed
|
|
||||||
- parameter clean: A boolean value indicating if the websocket connection was closed cleanly
|
|
||||||
*/
|
|
||||||
|
|
||||||
internal var onWebsocketClose: ((_ code:Int, _ reason:String, _ clean:Bool) -> ())? = { code, reason, clean in
|
|
||||||
NotificationCenter.default.post(name: Notification.Name(rawValue: DDP_WEBSOCKET_CLOSE), object: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
onWebsocketError executes when the websocket connection returns an error.
|
|
||||||
|
|
||||||
- parameter error: An ErrorType object describing the error
|
|
||||||
*/
|
|
||||||
|
|
||||||
internal var onWebsocketError: (_ error:Error) -> () = {error in
|
|
||||||
log.error("websocket error \(error)")
|
|
||||||
NotificationCenter.default.post(name: Notification.Name(rawValue: DDP_WEBSOCKET_ERROR), object: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
onConnected executes when the client makes a DDP connection
|
|
||||||
|
|
||||||
- parameter session: A string session id
|
|
||||||
*/
|
|
||||||
|
|
||||||
// public var onConnected: (session:String) -> () = {session in log.info("connected with session: \(session)")}
|
|
||||||
public var onConnected: Completion = Completion { session in log.info("connected with session: \(session)")}
|
|
||||||
|
|
||||||
/**
|
|
||||||
onDisconnected executes when the client is disconnected
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var onDisconnected: () -> () = {
|
|
||||||
log.debug("disconnected")
|
|
||||||
NotificationCenter.default.post(name: Notification.Name(rawValue: DDP_DISCONNECTED), object: nil)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
onFailed executes when an attempt to make a DDP connection fails
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var onFailed: () -> () = {
|
|
||||||
log.error("failed")
|
|
||||||
NotificationCenter.default.post(name: Notification.Name(rawValue: DDP_FAILED), object: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data messages
|
|
||||||
|
|
||||||
/**
|
|
||||||
onAdded executes when a document has been added to a local collection
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
- parameter fields: an optional NSDictionary with the documents properties
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var onAdded: ((_ collection:String, _ id:String, _ fields:NSDictionary?) -> ())?
|
|
||||||
|
|
||||||
/**
|
|
||||||
onChanged executes when the server sends an instruction to modify a local document
|
|
||||||
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
- parameter fields: an optional NSDictionary with the documents properties
|
|
||||||
- parameter cleared: an optional array of string property names to delete
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var onChanged: ((_ collection:String, _ id:String, _ fields:NSDictionary?, _ cleared:NSArray?) -> ())?
|
|
||||||
|
|
||||||
/**
|
|
||||||
onRemoved executes when the server sends an instruction to remove a document from the local collection
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var onRemoved: ((_ collection:String, _ id:String) -> ())?
|
|
||||||
|
|
||||||
// RPC Messages
|
|
||||||
// public var onResult: (json: NSDictionary?, callback:(result:Any?, error:Any?) -> ()) -> () = {json, callback in callback(result: json, error:nil) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
onUpdated executes when the server sends a notification that all the consequences of a method call have
|
|
||||||
been communicated to the client
|
|
||||||
|
|
||||||
- parameter methods: An array of method id strings
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var onUpdated: ((_ methods: [String]) -> ())?
|
|
||||||
|
|
||||||
/**
|
|
||||||
onError executes when the client receives a DDP error message
|
|
||||||
|
|
||||||
- parameter message: A DDPError message describing the error
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var onError: ((_ message:DDPError) -> ())?
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
//
|
|
||||||
// DDPExponentialBackoff.swift
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Created by Joseph Kitchener on 05/02/2016.
|
|
||||||
// Copyright © 2016 Joseph Kitchener. All rights reserved.
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
///Retry connection requests to the server. The retries exponentially increase the waiting time up to a certain threshold. The idea is that if the server is down temporarily, it is not overwhelmed with requests hitting at the same time when it comes back up.
|
|
||||||
|
|
||||||
class DDPExponentialBackoff {
|
|
||||||
|
|
||||||
|
|
||||||
init(retryInterval:Double = 0.01,maxWaitInterval:Double = 5,multiplier:Double = 1.5){
|
|
||||||
|
|
||||||
self.reconnectionRetryInterval = retryInterval
|
|
||||||
self._reconnectionRetryInterval = retryInterval
|
|
||||||
self.maxWaitInterval = maxWaitInterval
|
|
||||||
self.multiplier = multiplier
|
|
||||||
}
|
|
||||||
|
|
||||||
//Cached original interval time
|
|
||||||
fileprivate var _reconnectionRetryInterval:Double = 0
|
|
||||||
|
|
||||||
|
|
||||||
fileprivate var reconnectionRetryInterval:Double
|
|
||||||
fileprivate var maxWaitInterval:Double
|
|
||||||
fileprivate var multiplier:Double
|
|
||||||
|
|
||||||
|
|
||||||
///Perform a closure with increasing exponential delay time up to a max wait interval
|
|
||||||
func createBackoff(_ closure:@escaping ()->()) {
|
|
||||||
|
|
||||||
let previousRetryInterval = self.reconnectionRetryInterval
|
|
||||||
let newRetryInterval = min(previousRetryInterval * multiplier,maxWaitInterval)
|
|
||||||
|
|
||||||
self.reconnectionRetryInterval = previousRetryInterval < maxWaitInterval ? newRetryInterval: maxWaitInterval
|
|
||||||
|
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(
|
|
||||||
deadline: DispatchTime.now() + Double(Int64(self.reconnectionRetryInterval * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: closure)
|
|
||||||
// print(reconnectionRetryInterval)
|
|
||||||
}
|
|
||||||
|
|
||||||
//Reset backoff to orignal time
|
|
||||||
func reset(){
|
|
||||||
reconnectionRetryInterval = _reconnectionRetryInterval
|
|
||||||
}
|
|
||||||
|
|
||||||
//Sets the backoff
|
|
||||||
func setBackoff(_ retryInterval:Double,maxWaitInterval:Double,multiplier:Double){
|
|
||||||
self.reconnectionRetryInterval = retryInterval
|
|
||||||
self._reconnectionRetryInterval = retryInterval
|
|
||||||
self.maxWaitInterval = maxWaitInterval
|
|
||||||
self.multiplier = multiplier
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,535 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import CryptoSwift
|
|
||||||
|
|
||||||
private let DDP_ID = "DDP_ID"
|
|
||||||
private let DDP_EMAIL = "DDP_EMAIL"
|
|
||||||
private let DDP_USERNAME = "DDP_USERNAME"
|
|
||||||
private let DDP_TOKEN = "DDP_TOKEN"
|
|
||||||
private let DDP_TOKEN_EXPIRES = "DDP_TOKEN_EXPIRES"
|
|
||||||
private let DDP_LOGGED_IN = "DDP_LOGGED_IN"
|
|
||||||
|
|
||||||
public let DDP_USER_DID_LOGIN = "DDP_USER_DID_LOGIN"
|
|
||||||
public let DDP_USER_DID_LOGOUT = "DDP_USER_DID_LOGOUT"
|
|
||||||
|
|
||||||
let SWIFT_DDP_CALLBACK_DISPATCH_TIME = DispatchTime.distantFuture
|
|
||||||
|
|
||||||
private let syncWarning = {(name:String) -> Void in
|
|
||||||
if Thread.isMainThread {
|
|
||||||
print("\(name) is running synchronously on the main thread. This will block the main thread and should be run on a background thread")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension String {
|
|
||||||
func dictionaryValue() -> NSDictionary? {
|
|
||||||
if let data = self.data(using: String.Encoding.utf8, allowLossyConversion: false) {
|
|
||||||
let dictionary = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions(rawValue: 0)) as! NSDictionary
|
|
||||||
return dictionary
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension NSDictionary {
|
|
||||||
func stringValue() -> String? {
|
|
||||||
if let data = try? JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions(rawValue: 0)) {
|
|
||||||
return String(data: data, encoding: String.Encoding.utf8)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Extensions that provide an api for interacting with basic Meteor server-side services
|
|
||||||
*/
|
|
||||||
|
|
||||||
extension DDPClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func subscribe(_ name:String) -> String { return sub(name, params:nil) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription
|
|
||||||
- parameter params: An object containing method arguments, if any
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func subscribe(_ name:String, params:[Any]) -> String { return sub(name, params:params) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server. If a callback is passed, the callback asynchronously
|
|
||||||
runs when the client receives a 'ready' message indicating that the initial subset of documents contained
|
|
||||||
in the subscription has been sent by the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription
|
|
||||||
- parameter params: An object containing method arguments, if any
|
|
||||||
- parameter callback: The closure to be executed when the server sends a 'ready' message
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func subscribe(_ name:String, params:[Any]?, callback: DDPCallback?) -> String { return sub(name, params:params, callback:callback) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server. If a callback is passed, the callback asynchronously
|
|
||||||
runs when the client receives a 'ready' message indicating that the initial subset of documents contained
|
|
||||||
in the subscription has been sent by the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription
|
|
||||||
- parameter callback: The closure to be executed when the server sends a 'ready' message
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func subscribe(_ name:String, callback: DDPCallback?) -> String { return sub(name, params:nil, callback:callback) }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Asynchronously inserts a document into a collection on the server
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to insert
|
|
||||||
- parameter callback: A closure with result and error arguments describing the result of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult public func insert(_ collection: String, document: NSArray, callback: DDPMethodCallback?) -> String {
|
|
||||||
let arg = "/\(collection)/insert"
|
|
||||||
return self.method(arg, params: document, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Asynchronously inserts a document into a collection on the server
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to insert
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func insert(_ collection: String, document: NSArray) -> String {
|
|
||||||
return insert(collection, document: document, callback:nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Synchronously inserts a document into a collection on the server. Cannot be used on the main queue.
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to insert
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func insert(sync collection: String, document: NSArray) -> Result {
|
|
||||||
|
|
||||||
syncWarning("Insert")
|
|
||||||
|
|
||||||
let semaphore = DispatchSemaphore(value: 0)
|
|
||||||
var serverResponse = Result()
|
|
||||||
|
|
||||||
insert(collection, document:document) { result, error in
|
|
||||||
serverResponse.result = result
|
|
||||||
serverResponse.error = error
|
|
||||||
semaphore.signal()
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = semaphore.wait(timeout: SWIFT_DDP_CALLBACK_DISPATCH_TIME)
|
|
||||||
|
|
||||||
return serverResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Asynchronously updates a document into a collection on the server
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to update
|
|
||||||
- parameter callback: A closure with result and error arguments describing the result of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult public func update(_ collection: String, document: NSArray, callback: DDPMethodCallback?) -> String {
|
|
||||||
let arg = "/\(collection)/update"
|
|
||||||
return method(arg, params: document, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Asynchronously updates a document on the server
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to update
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func update(_ collection: String, document: NSArray) -> String {
|
|
||||||
return update(collection, document: document, callback:nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Synchronously updates a document on the server. Cannot be used on the main queue
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to update
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func update(sync collection: String, document: NSArray) -> Result {
|
|
||||||
syncWarning("Update")
|
|
||||||
|
|
||||||
let semaphore = DispatchSemaphore(value: 0)
|
|
||||||
var serverResponse = Result()
|
|
||||||
|
|
||||||
update(collection, document:document) { result, error in
|
|
||||||
serverResponse.result = result
|
|
||||||
serverResponse.error = error
|
|
||||||
semaphore.signal()
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = semaphore.wait(timeout: SWIFT_DDP_CALLBACK_DISPATCH_TIME)
|
|
||||||
|
|
||||||
return serverResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Asynchronously removes a document on the server
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to remove
|
|
||||||
- parameter callback: A closure with result and error arguments describing the result of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult public func remove(_ collection: String, document: NSArray, callback: DDPMethodCallback?) -> String {
|
|
||||||
let arg = "/\(collection)/remove"
|
|
||||||
return method(arg, params: document, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Asynchronously removes a document into a collection on the server
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to remove
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func remove(_ collection: String, document: NSArray) -> String {
|
|
||||||
return remove(collection, document: document, callback:nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Synchronously removes a document into a collection on the server. Cannot be used on the main queue.
|
|
||||||
|
|
||||||
- parameter collection: The name of the collection
|
|
||||||
- parameter document: An NSArray of documents to remove
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func remove(sync collection: String, document: NSArray) -> Result {
|
|
||||||
syncWarning("Remove")
|
|
||||||
|
|
||||||
let semaphore = DispatchSemaphore(value: 0)
|
|
||||||
var serverResponse = Result()
|
|
||||||
|
|
||||||
remove(collection, document:document) { result, error in
|
|
||||||
serverResponse.result = result
|
|
||||||
serverResponse.error = error
|
|
||||||
semaphore.signal()
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = semaphore.wait(timeout: SWIFT_DDP_CALLBACK_DISPATCH_TIME)
|
|
||||||
|
|
||||||
return serverResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback runs on main thread
|
|
||||||
public func login(_ params: NSDictionary, callback: ((_ result: Any?, _ error: DDPError?) -> ())?) {
|
|
||||||
|
|
||||||
// method is run on the userBackground queue
|
|
||||||
method("login", params: NSArray(arrayLiteral: params)) { result, error in
|
|
||||||
guard let e = error, (e.isValid == true) else {
|
|
||||||
|
|
||||||
if let user = params["user"] as? NSDictionary {
|
|
||||||
if let email = user["email"] {
|
|
||||||
self.userData.set(email, forKey: DDP_EMAIL)
|
|
||||||
}
|
|
||||||
if let username = user["username"] {
|
|
||||||
self.userData.set(username, forKey: DDP_USERNAME)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let data = result as? NSDictionary,
|
|
||||||
let id = data["id"] as? String,
|
|
||||||
let token = data["token"] as? String,
|
|
||||||
let tokenExpires = data["tokenExpires"] as? NSDictionary {
|
|
||||||
let expiration = dateFromTimestamp(tokenExpires)
|
|
||||||
self.userData.set(id, forKey: DDP_ID)
|
|
||||||
self.userData.set(token, forKey: DDP_TOKEN)
|
|
||||||
self.userData.set(expiration, forKey: DDP_TOKEN_EXPIRES)
|
|
||||||
}
|
|
||||||
|
|
||||||
self.userMainQueue.addOperation() {
|
|
||||||
|
|
||||||
if let c = callback { c(result, error) }
|
|
||||||
self.userData.set(true, forKey: DDP_LOGGED_IN)
|
|
||||||
|
|
||||||
NotificationCenter.default.post(name: Notification.Name(rawValue: DDP_USER_DID_LOGIN), object: nil)
|
|
||||||
|
|
||||||
if let _ = self.delegate {
|
|
||||||
self.delegate!.ddpUserDidLogin(self.user()!)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug("Login error: \(e)")
|
|
||||||
if let c = callback { c(result, error) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using an email and password
|
|
||||||
|
|
||||||
- parameter email: An email string
|
|
||||||
- parameter password: A password string
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func loginWithPassword(_ email: String, password: String, callback: DDPMethodCallback?) {
|
|
||||||
if !(loginWithToken(callback)) {
|
|
||||||
let params = ["user": ["email": email], "password":["digest": password.sha256(), "algorithm":"sha-256"]] as NSDictionary
|
|
||||||
login(params, callback: callback)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using a username and password
|
|
||||||
|
|
||||||
- parameter username: A username string
|
|
||||||
- parameter password: A password string
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func loginWithUsername(_ username: String, password: String, callback: DDPMethodCallback?) {
|
|
||||||
if !(loginWithToken(callback)) {
|
|
||||||
let params = ["user": ["username": username], "password":["digest": password.sha256(), "algorithm":"sha-256"]] as NSDictionary
|
|
||||||
login(params, callback: callback)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Attempts to login a user with a token, if one exists
|
|
||||||
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult public func loginWithToken(_ callback: DDPMethodCallback?) -> Bool {
|
|
||||||
if let token = userData.string(forKey: DDP_TOKEN),
|
|
||||||
let tokenDate = userData.object(forKey: DDP_TOKEN_EXPIRES) as? Date {
|
|
||||||
print("Found token & token expires \(token), \(tokenDate)")
|
|
||||||
if (tokenDate.compare(Date()) == ComparisonResult.orderedDescending) {
|
|
||||||
let params = ["resume":token] as NSDictionary
|
|
||||||
login(params, callback:callback)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public func signup(_ params:NSDictionary, callback:((_ result: Any?, _ error: DDPError?) -> ())?) {
|
|
||||||
method("createUser", params: NSArray(arrayLiteral: params)) { result, error in
|
|
||||||
guard let e = error, (e.isValid == true) else {
|
|
||||||
|
|
||||||
if let email = params["email"] {
|
|
||||||
self.userData.set(email, forKey: DDP_EMAIL)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let username = params["username"] {
|
|
||||||
self.userData.set(username, forKey: DDP_USERNAME)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let data = result as? NSDictionary,
|
|
||||||
let id = data["id"] as? String,
|
|
||||||
let token = data["token"] as? String,
|
|
||||||
let tokenExpires = data["tokenExpires"] as? NSDictionary {
|
|
||||||
let expiration = dateFromTimestamp(tokenExpires)
|
|
||||||
self.userData.set(id, forKey: DDP_ID)
|
|
||||||
self.userData.set(token, forKey: DDP_TOKEN)
|
|
||||||
self.userData.set(expiration, forKey: DDP_TOKEN_EXPIRES)
|
|
||||||
self.userData.synchronize()
|
|
||||||
}
|
|
||||||
if let c = callback { c(result, error) }
|
|
||||||
self.userData.set(true, forKey: DDP_LOGGED_IN)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug("login error: \(e)")
|
|
||||||
if let c = callback { c(result, error) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
Invokes a Meteor method to create a user account with a given email and password on the server
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func signupWithEmail(_ email: String, password: String, callback: ((_ result:Any?, _ error:DDPError?) -> ())?) {
|
|
||||||
let params = ["email":email, "password":["digest":password.sha256(), "algorithm":"sha-256"]] as [String : Any]
|
|
||||||
signup(params as NSDictionary, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Invokes a Meteor method to create a user account with a given email and password, and a NSDictionary containing a user profile
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func signupWithEmail(_ email: String, password: String, profile: NSDictionary, callback: ((_ result:Any?, _ error:DDPError?) -> ())?) {
|
|
||||||
let params = ["email":email, "password":["digest":password.sha256(), "algorithm":"sha-256"], "profile":profile] as [String : Any]
|
|
||||||
signup(params as NSDictionary, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Invokes a Meteor method to create a user account with a given username, email and password, and a NSDictionary containing a user profile
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func signupWithUsername(_ username: String, password: String, email: String?, profile: NSDictionary?, callback: ((_ result:Any?, _ error:DDPError?) -> ())?) {
|
|
||||||
let params: NSMutableDictionary = ["username":username, "password":["digest":password.sha256(), "algorithm":"sha-256"]]
|
|
||||||
if let email = email {
|
|
||||||
params.setValue(email, forKey: "email")
|
|
||||||
}
|
|
||||||
if let profile = profile {
|
|
||||||
params.setValue(profile, forKey: "profile")
|
|
||||||
}
|
|
||||||
signup(params, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the client userId, if it exists
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func userId() -> String? {
|
|
||||||
return self.userData.object(forKey: DDP_ID) as? String
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the client's username or email, if it exists
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func user() -> String? {
|
|
||||||
if let username = self.userData.object(forKey: DDP_USERNAME) as? String {
|
|
||||||
return username
|
|
||||||
} else if let email = self.userData.object(forKey: DDP_EMAIL) as? String {
|
|
||||||
return email
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
internal func resetUserData() {
|
|
||||||
self.userData.set(false, forKey: DDP_LOGGED_IN)
|
|
||||||
self.userData.removeObject(forKey: DDP_ID)
|
|
||||||
self.userData.removeObject(forKey: DDP_EMAIL)
|
|
||||||
self.userData.removeObject(forKey: DDP_USERNAME)
|
|
||||||
self.userData.removeObject(forKey: DDP_TOKEN)
|
|
||||||
self.userData.removeObject(forKey: DDP_TOKEN_EXPIRES)
|
|
||||||
self.userData.synchronize()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user out and removes their account data from NSUserDefaults
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func logout() {
|
|
||||||
logout(nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user out and removes their account data from NSUserDefaults.
|
|
||||||
When it completes, it posts a notification: DDP_USER_DID_LOGOUT on the main queue
|
|
||||||
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func logout(_ callback:DDPMethodCallback?) {
|
|
||||||
method("logout", params: nil) { result, error in
|
|
||||||
if let error = error {
|
|
||||||
log.error("\(error)")
|
|
||||||
} else {
|
|
||||||
self.userMainQueue.addOperation() {
|
|
||||||
if let user = self.user(),
|
|
||||||
let delegate = self.delegate {
|
|
||||||
delegate.ddpUserDidLogout(user)
|
|
||||||
}
|
|
||||||
self.resetUserData()
|
|
||||||
NotificationCenter.default.post(name: Notification.Name(rawValue: DDP_USER_DID_LOGOUT), object: nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
callback?(result, error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Automatically attempts to resume a prior session, if one exists
|
|
||||||
|
|
||||||
- parameter url: The server url
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func resume(_ url:String, callback:DDPCallback?) {
|
|
||||||
connect(url) { session in
|
|
||||||
if let _ = self.user() {
|
|
||||||
if !self.loginWithToken() { result, error in
|
|
||||||
if error == nil {
|
|
||||||
log.debug("Resumed previous session at launch")
|
|
||||||
if let completion = callback { completion() }
|
|
||||||
} else {
|
|
||||||
self.logout()
|
|
||||||
log.error("\(error)")
|
|
||||||
callback?()
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
self.logout()
|
|
||||||
callback?()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let completion = callback { completion() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Connects and logs in with an email address and password in one action
|
|
||||||
|
|
||||||
- parameter url: String url, ex. wss://todos.meteor.com/websocket
|
|
||||||
- parameter email: String email address
|
|
||||||
- parameter password: String password
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
public convenience init(url: String, email: String, password: String, callback: DDPMethodCallback?) {
|
|
||||||
self.init()
|
|
||||||
connect(url) { session in
|
|
||||||
self.loginWithPassword(email, password: password, callback:callback)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns true if the user is logged in, and false otherwise
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func loggedIn() -> Bool {
|
|
||||||
if let userLoggedIn = self.userData.object(forKey: DDP_LOGGED_IN) as? Bool, (userLoggedIn == true) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,341 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
/**
|
|
||||||
Enum value representing the types of DDP messages that the server can send
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Handled Message Types
|
|
||||||
public enum DDPMessageType:String {
|
|
||||||
|
|
||||||
// case Connect = "connect" // (client -> server)
|
|
||||||
case Connected = "connected"
|
|
||||||
case Failed = "failed"
|
|
||||||
case Ping = "ping"
|
|
||||||
case Pong = "pong"
|
|
||||||
// case Sub = "sub" // (client -> server)
|
|
||||||
// case Unsub = "unsub" // (client -> server)
|
|
||||||
case Nosub = "nosub"
|
|
||||||
case Added = "added"
|
|
||||||
case Changed = "changed"
|
|
||||||
case Removed = "removed"
|
|
||||||
case Ready = "ready"
|
|
||||||
case AddedBefore = "addedBefore"
|
|
||||||
case MovedBefore = "movedBefore"
|
|
||||||
// case Method = "method" // (client -> server)
|
|
||||||
case Result = "result"
|
|
||||||
case Updated = "updated"
|
|
||||||
case Error = "error"
|
|
||||||
case Unhandled = "unhandled"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Method or Nosub error
|
|
||||||
// Such an Error is used to represent errors raised by the method or subscription,
|
|
||||||
// as well as an attempt to subscribe to an unknown subscription or call an unknown method.
|
|
||||||
|
|
||||||
// Other erroneous messages sent from the client to the server can result in receiving a top-level msg: 'error' message in response. These conditions include:
|
|
||||||
|
|
||||||
// - sending messages which are not valid JSON objects
|
|
||||||
// - unknown msg type
|
|
||||||
// - other malformed client requests (not including required fields)
|
|
||||||
// - sending anything other than connect as the first message, or sending connect as a non-initial message
|
|
||||||
// The error message contains the following fields:
|
|
||||||
|
|
||||||
// - reason: string describing the error
|
|
||||||
// - offendingMessage: if the original message parsed properly, it is included here
|
|
||||||
|
|
||||||
/**
|
|
||||||
A struct to parse, encapsulate and facilitate handling of DDP message strings
|
|
||||||
*/
|
|
||||||
|
|
||||||
public struct DDPMessage {
|
|
||||||
|
|
||||||
/**
|
|
||||||
The message's properties, stored as an NSDictionary
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var json:NSDictionary!
|
|
||||||
|
|
||||||
/**
|
|
||||||
Initialize a message struct, with a Json string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public init(message:String) {
|
|
||||||
|
|
||||||
if let JSON = message.dictionaryValue() { json = JSON }
|
|
||||||
else {
|
|
||||||
json = ["msg":"error", "reason":"SwiftDDP JSON serialization error.",
|
|
||||||
"details": "SwiftDDP JSON serialization error. JSON string was: \(message). Message will be handled as a DDP message error."]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Initialize a message struct, with a dictionary of strings
|
|
||||||
*/
|
|
||||||
|
|
||||||
public init(message:[String:String]) {
|
|
||||||
json = message as NSDictionary
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Converts an NSDictionary to a JSON string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static func toString(_ json:Any) -> String? {
|
|
||||||
if let data = try? JSONSerialization.data(withJSONObject: json, options: JSONSerialization.WritingOptions(rawValue: 0)) {
|
|
||||||
let message = NSString(data: data, encoding: String.Encoding.ascii.rawValue) as String?
|
|
||||||
return message
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Computed variables
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the DDP message type, of type DDPMessageType enum
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var type:DDPMessageType {
|
|
||||||
if let msg = message,
|
|
||||||
let type = DDPMessageType(rawValue: msg) {
|
|
||||||
return type
|
|
||||||
}
|
|
||||||
return DDPMessageType(rawValue: "unhandled")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns a boolean value indicating if the message is an error message or not
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var isError:Bool {
|
|
||||||
if (self.type == .Error) { return true } // if message is a top level error ("msg"="error")
|
|
||||||
if let _ = self.error { return true } // if message contains an error object, as in method or nosub
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the root-level keys of the JSON object
|
|
||||||
internal var keys:[String] {
|
|
||||||
return json.allKeys as! [String]
|
|
||||||
}
|
|
||||||
|
|
||||||
public func hasProperty(_ name:String) -> Bool {
|
|
||||||
if let property = json[name], ((property as! NSObject) != NSNull()) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP message
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var message:String? {
|
|
||||||
get { return json["msg"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP session string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var session:String? {
|
|
||||||
get { return json["session"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP version string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var version:String? {
|
|
||||||
get { return json["version"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP support string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var support:String? {
|
|
||||||
get { return json["support"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP message id string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var id:String? {
|
|
||||||
get { return json["id"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP name string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var name:String? {
|
|
||||||
get { return json["name"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP param string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var params:String? {
|
|
||||||
get { return json["params"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP error object
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var error:DDPError? {
|
|
||||||
get { if let e = json["error"] as? NSDictionary { return DDPError(json:e) } else { return nil }}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP collection name string
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var collection:String? {
|
|
||||||
get { return json["collection"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP fields dictionary
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var fields:NSDictionary? {
|
|
||||||
get { return json["fields"] as? NSDictionary }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional DDP cleared array. Contains an array of fields that should be removed
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var cleared:[String]? {
|
|
||||||
get { return json["cleared"] as? [String] }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional method name
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var method:String? {
|
|
||||||
get { return json["method"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional random seed JSON value (an arbitrary client-determined seed for pseudo-random generators)
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var randomSeed:String? {
|
|
||||||
get { return json["randomSeed"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional result object, containing the result of a method call
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var result:Any? {
|
|
||||||
get { return json.object(forKey: "result") as Any? }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional array of ids passed to 'method', all of whose writes have been reflected in data messages)
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var methods:[String]? {
|
|
||||||
get { return json["methods"] as? [String] }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional array of id strings passed to 'sub' which have sent their initial batch of data
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var subs:[String]? {
|
|
||||||
get { return json["subs"] as? [String] }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional reason given for an error returned from the server
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var reason:String? {
|
|
||||||
get { return json["reason"] as? String }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
The optional original error message
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var offendingMessage:String? {
|
|
||||||
get { return json["offendingMessage"] as? String }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
A struct encapsulating a DDP error message
|
|
||||||
*/
|
|
||||||
|
|
||||||
public struct DDPError: Error {
|
|
||||||
|
|
||||||
fileprivate var json:NSDictionary?
|
|
||||||
|
|
||||||
/**
|
|
||||||
The string error code
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var error:String? { return json?["error"] as? String } // Error code
|
|
||||||
|
|
||||||
/**
|
|
||||||
The detailed message given for an error returned from the server
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var reason:String? { return json?["reason"] as? String }
|
|
||||||
|
|
||||||
/**
|
|
||||||
The string providing error details
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var details:String? { return json?["details"] as? String }
|
|
||||||
|
|
||||||
/**
|
|
||||||
If the original message parsed properly, it is included here
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var offendingMessage:String? { return json?["offendingMessage"] as? String }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Helper variable that returns true if the struct has both an error code and a reason
|
|
||||||
*/
|
|
||||||
|
|
||||||
var isValid:Bool {
|
|
||||||
if let _ = error { return true }
|
|
||||||
if let _ = reason { return true }
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
init(json:Any?) {
|
|
||||||
self.json = json as? NSDictionary
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
/**
|
|
||||||
Struct to encapsulate the result of a Meteor method call
|
|
||||||
*/
|
|
||||||
|
|
||||||
public struct Result {
|
|
||||||
|
|
||||||
/**
|
|
||||||
The result of the method call
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var result:Any?
|
|
||||||
|
|
||||||
/**
|
|
||||||
An error object describing the server-side error, or nil if the method completed successfully
|
|
||||||
*/
|
|
||||||
|
|
||||||
public var error:DDPError?
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
// Base64
|
|
||||||
|
|
||||||
func randomBase64String(_ n: Int = 20) -> String {
|
|
||||||
|
|
||||||
var string = ""
|
|
||||||
let BASE64_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
|
|
||||||
|
|
||||||
for _ in 1...n {
|
|
||||||
let r = arc4random() % UInt32(BASE64_CHARS.characters.count)
|
|
||||||
let index = BASE64_CHARS.characters.index(BASE64_CHARS.startIndex, offsetBy: Int(r))
|
|
||||||
let c = BASE64_CHARS[index]
|
|
||||||
string += String(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
return string
|
|
||||||
}
|
|
||||||
|
|
||||||
func toBase64(_ string: String) -> String {
|
|
||||||
let encodedData = (string as NSString).data(using: String.Encoding.utf8.rawValue)
|
|
||||||
let base64String = encodedData!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
|
|
||||||
return base64String as String
|
|
||||||
}
|
|
||||||
|
|
||||||
func fromBase64(_ string: String) -> String {
|
|
||||||
let decodedData = Data(base64Encoded: string, options: NSData.Base64DecodingOptions(rawValue: 0))
|
|
||||||
let decodedString = String(data: decodedData!, encoding: .utf8)
|
|
||||||
return decodedString ?? ""
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// URL Parsing
|
|
||||||
|
|
||||||
// Returns a dictionary of arguments
|
|
||||||
func getArguments(fromUrl url: String) -> [String:String] {
|
|
||||||
var componentsDictionary:[String:String] = [:]
|
|
||||||
let components = URLComponents(string: url)
|
|
||||||
components?.queryItems?.forEach { item in componentsDictionary[item.name] = item.value }
|
|
||||||
return componentsDictionary
|
|
||||||
}
|
|
||||||
|
|
||||||
func getValue(fromUrl url: String, forArgument argument:String) -> String? {
|
|
||||||
let arguments = getArguments(fromUrl: url)
|
|
||||||
print("Arguments \(arguments) for url: \(url)")
|
|
||||||
return arguments[argument]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
|
|
||||||
func dateFromTimestamp(_ containedIn: NSDictionary) -> Date {
|
|
||||||
let date = containedIn["$date"] as? Double
|
|
||||||
let timestamp = TimeInterval(date! / 1000)
|
|
||||||
return Date(timeIntervalSince1970: timestamp)
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
// {"$date": MILLISECONDS_SINCE_EPOCH} // Dates
|
|
||||||
// {"$binary": BASE_64_STRING} // Binary data:
|
|
||||||
// {"$escape": THING} // Escaped things that might otherwise look like EJSON types
|
|
||||||
// {"$type": TYPENAME, "$value": VALUE} // User specified types
|
|
||||||
|
|
||||||
open class EJSON: NSObject {
|
|
||||||
|
|
||||||
/**
|
|
||||||
Determines whether a given key is an eJSON key
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func isEJSON(_ key:String) -> Bool {
|
|
||||||
switch key {
|
|
||||||
case "$date": return true
|
|
||||||
case "$binary": return true
|
|
||||||
case "$type": return true
|
|
||||||
default: return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Converts an eJSON date to NSDate
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func convertToNSDate(_ ejson:NSDictionary) -> Date {
|
|
||||||
let timeInterval = TimeInterval(ejson.value(forKey: "$date") as! Double) / 1000
|
|
||||||
return Date(timeIntervalSince1970: timeInterval)
|
|
||||||
}
|
|
||||||
|
|
||||||
open static func convertToEJSONDate(_ date:Date) -> [String:Double] {
|
|
||||||
let timeInterval = Double(date.timeIntervalSince1970) * 1000
|
|
||||||
print("Date -> \(date), \(timeInterval)")
|
|
||||||
return ["$date": timeInterval]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>$(PRODUCT_NAME)</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>FMWK</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string></string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,350 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
/*
|
|
||||||
enum Error: String {
|
|
||||||
case BadRequest = "400" // The server cannot or will not process the request due to something that is perceived to be a client error
|
|
||||||
case Unauthorized = "401" // Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided.
|
|
||||||
case NotFound = "404" // ex. Method not found, Subscription not found
|
|
||||||
case Forbidden = "403" // Not authorized to access resource, also issued when you've been logged out by the server
|
|
||||||
case RequestConflict = "409" // ex. MongoError: E11000 duplicate key error
|
|
||||||
case PayloadTooLarge = "413" // The request is larger than the server is willing or able to process.
|
|
||||||
case InternalServerError = "500"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public protocol MeteorCollectionType {
|
|
||||||
func documentWasAdded(_ collection:String, id:String, fields:NSDictionary?)
|
|
||||||
func documentWasChanged(_ collection:String, id:String, fields:NSDictionary?, cleared:[String]?)
|
|
||||||
func documentWasRemoved(_ collection:String, id:String)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Meteor is a class to simplify communicating with and consuming MeteorJS server services
|
|
||||||
*/
|
|
||||||
|
|
||||||
open class Meteor {
|
|
||||||
|
|
||||||
/**
|
|
||||||
client is a singleton instance of DDPClient
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static let client = Meteor.Client() // Client is a singleton object
|
|
||||||
|
|
||||||
internal static var collections = [String:MeteorCollectionType]()
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns a Meteor collection, if it exists
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func collection(_ name:String) -> MeteorCollectionType? {
|
|
||||||
return collections[name]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult open static func subscribe(_ name:String) -> String { return client.sub(name, params:nil) }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription.
|
|
||||||
- parameter params: An object containing method arguments, if any.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult open static func subscribe(_ name:String, params:[Any]) -> String { return client.sub(name, params:params) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server. If a callback is passed, the callback asynchronously
|
|
||||||
runs when the client receives a 'ready' message indicating that the initial subset of documents contained
|
|
||||||
in the subscription has been sent by the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription.
|
|
||||||
- parameter params: An object containing method arguments, if any.
|
|
||||||
- parameter callback: The closure to be executed when the server sends a 'ready' message.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult open static func subscribe(_ name:String, params:[Any]?, callback: DDPCallback?) -> String { return client.sub(name, params:params, callback:callback) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends a subscription request to the server. If a callback is passed, the callback asynchronously
|
|
||||||
runs when the client receives a 'ready' message indicating that the initial subset of documents contained
|
|
||||||
in the subscription has been sent by the server.
|
|
||||||
|
|
||||||
- parameter name: The name of the subscription.
|
|
||||||
- parameter callback: The closure to be executed when the server sends a 'ready' message.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult open static func subscribe(_ name:String, callback: DDPCallback?) -> String { return client.sub(name, params: nil, callback: callback) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends an unsubscribe request to the server. Unsubscibes to all subscriptions with the provided name.
|
|
||||||
- parameter name: The name of the subscription.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult open static func unsubscribe(_ name:String, callback:DDPCallback?) -> [String] { return client.unsub(withName: name, callback: callback) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends an unsubscribe request to the server using a subscription id. This allows fine-grained control of subscriptions. For example, you can unsubscribe to specific combinations of subscriptions and subscription parameters.
|
|
||||||
- parameter id: An id string returned from a subscription request
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func unsubscribe(withId id:String) { return client.unsub(withId: id, callback: nil) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sends an unsubscribe request to the server using a subscription id. This allows fine-grained control of subscriptions. For example, you can unsubscribe to specific combinations of subscriptions and subscription parameters. If a callback is passed, the callback asynchronously
|
|
||||||
runs when the unsubscribe transaction is complete.
|
|
||||||
- parameter id: An id string returned from a subscription request
|
|
||||||
- parameter callback: The closure to be executed when the method has been executed
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func unsubscribe(withId id:String, callback:DDPCallback?) { return client.unsub(withId: id, callback: callback) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Calls a method on the server. If a callback is passed, the callback is asynchronously
|
|
||||||
executed when the method has completed. The callback takes two arguments: result and error. It
|
|
||||||
the method call is successful, result contains the return value of the method, if any. If the method fails,
|
|
||||||
error contains information about the error.
|
|
||||||
|
|
||||||
- parameter name: The name of the method
|
|
||||||
- parameter params: An array containing method arguments, if any
|
|
||||||
- parameter callback: The closure to be executed when the method has been executed
|
|
||||||
*/
|
|
||||||
|
|
||||||
@discardableResult open static func call(_ name:String, params:[Any]?, callback:DDPMethodCallback?) -> String? {
|
|
||||||
return client.method(name, params: params, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Call a single function to establish a DDP connection, and login with email and password
|
|
||||||
|
|
||||||
- parameter url: The url of a Meteor server
|
|
||||||
- parameter email: A string email address associated with a Meteor account
|
|
||||||
- parameter password: A string password
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func connect(_ url:String, email:String, password:String) {
|
|
||||||
client.connect(url) { session in
|
|
||||||
client.loginWithPassword(email, password: password) { result, error in
|
|
||||||
guard let _ = error else {
|
|
||||||
if let _ = result as? NSDictionary {
|
|
||||||
// client.userDidLogin(credentials)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Connect to a Meteor server and resume a prior session, if the user was logged in
|
|
||||||
|
|
||||||
- parameter url: The url of a Meteor server
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func connect(_ url:String) {
|
|
||||||
client.resume(url, callback: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Connect to a Meteor server and resume a prior session, if the user was logged in
|
|
||||||
|
|
||||||
- parameter url: The url of a Meteor server
|
|
||||||
- parameter callback: An optional closure to be executed after the connection is established
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func connect(_ url:String, callback:DDPCallback?) {
|
|
||||||
client.resume(url, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a user account on the server with an email and password
|
|
||||||
|
|
||||||
- parameter email: An email string
|
|
||||||
- parameter password: A password string
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func signupWithEmail(_ email: String, password: String, callback: DDPMethodCallback?) {
|
|
||||||
client.signupWithEmail(email, password: password, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a user account on the server with an email and password
|
|
||||||
|
|
||||||
- parameter email: An email string
|
|
||||||
- parameter password: A password string
|
|
||||||
- parameter profile: A dictionary containing the user profile
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func signupWithEmail(_ email: String, password: String, profile: NSDictionary, callback: DDPMethodCallback?) {
|
|
||||||
client.signupWithEmail(email, password: password, profile: profile, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a user account on the server with a username and password
|
|
||||||
|
|
||||||
- parameter username: A username string
|
|
||||||
- parameter password: A password string
|
|
||||||
- parameter email: An email to be associated with the account
|
|
||||||
- parameter profile: A dictionary containing the user profile
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func signupWithUsername(_ username: String, password: String, email: String? = nil, profile: NSDictionary? = nil, callback: DDPMethodCallback? = nil) {
|
|
||||||
client.signupWithUsername(username, password: password, email: email, profile: profile, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using an email and password
|
|
||||||
|
|
||||||
- parameter email: An email string
|
|
||||||
- parameter password: A password string
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func loginWithPassword(_ email:String, password:String, callback:DDPMethodCallback?) {
|
|
||||||
client.loginWithPassword(email, password: password, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using an email and password
|
|
||||||
|
|
||||||
- parameter email: An email string
|
|
||||||
- parameter password: A password string
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func loginWithPassword(_ email:String, password:String) {
|
|
||||||
client.loginWithPassword(email, password: password, callback: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using a username and password
|
|
||||||
|
|
||||||
- parameter username: A username string
|
|
||||||
- parameter password: A password string
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func loginWithUsername(_ username:String, password:String, callback:DDPMethodCallback? = nil) {
|
|
||||||
client.loginWithUsername(username, password: password, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using a third party auth provider
|
|
||||||
|
|
||||||
- parameter params: sign in parameters
|
|
||||||
- parameter callback: A closure with result and error parameters describing the outcome of the operation
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func login(_ params: NSDictionary, callback:DDPMethodCallback?) {
|
|
||||||
client.login(params, callback: callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user out of the server and executes a callback when the logout process has completed
|
|
||||||
|
|
||||||
- parameter callback: An optional closure to be executed after the client has logged out
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func logout(_ callback:DDPMethodCallback?) {
|
|
||||||
client.logout(callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user out of the server
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func logout() {
|
|
||||||
client.logout()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Meteor.Client is a subclass of DDPClient that facilitates interaction with the MeteorCollection class
|
|
||||||
*/
|
|
||||||
|
|
||||||
open class Client: DDPClient {
|
|
||||||
|
|
||||||
typealias SubscriptionCallback = () -> ()
|
|
||||||
let notifications = NotificationCenter.default
|
|
||||||
|
|
||||||
public convenience init(url:String, email:String, password:String) {
|
|
||||||
self.init()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Calls the documentWasAdded method in the MeteorCollection subclass instance associated with the document
|
|
||||||
collection
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
- parameter fields: an optional NSDictionary with the documents properties
|
|
||||||
*/
|
|
||||||
|
|
||||||
open override func documentWasAdded(_ collection:String, id:String, fields:NSDictionary?) {
|
|
||||||
if let meteorCollection = Meteor.collections[collection] {
|
|
||||||
meteorCollection.documentWasAdded(collection, id: id, fields: fields)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Calls the documentWasChanged method in the MeteorCollection subclass instance associated with the document
|
|
||||||
collection
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
- parameter fields: an optional NSDictionary with the documents properties
|
|
||||||
- parameter cleared: an optional array of string property names to delete
|
|
||||||
*/
|
|
||||||
|
|
||||||
open override func documentWasChanged(_ collection:String, id:String, fields:NSDictionary?, cleared:[String]?) {
|
|
||||||
if let meteorCollection = Meteor.collections[collection] {
|
|
||||||
meteorCollection.documentWasChanged(collection, id: id, fields: fields, cleared: cleared)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Calls the documentWasRemoved method in the MeteorCollection subclass instance associated with the document
|
|
||||||
collection
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
*/
|
|
||||||
|
|
||||||
open override func documentWasRemoved(_ collection:String, id:String) {
|
|
||||||
if let meteorCollection = Meteor.collections[collection] {
|
|
||||||
meteorCollection.documentWasRemoved(collection, id: id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,240 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
public let METEOR_COLLECTION_SET_DID_CHANGE = "METEOR_COLLECTION_SET_DID_CHANGE"
|
|
||||||
|
|
||||||
func debounce( _ delay:TimeInterval, queue:DispatchQueue, action: @escaping (()->()) ) -> ()->() {
|
|
||||||
|
|
||||||
var lastFireTime = DispatchTime(uptimeNanoseconds: 0)
|
|
||||||
let dispatchDelay = Int64(delay * Double(NSEC_PER_SEC))
|
|
||||||
|
|
||||||
return {
|
|
||||||
lastFireTime = DispatchTime.now() + Double(0) / Double(NSEC_PER_SEC)
|
|
||||||
queue.asyncAfter(
|
|
||||||
deadline: DispatchTime.now() + Double(dispatchDelay) / Double(NSEC_PER_SEC)) {
|
|
||||||
let now = DispatchTime.now() + Double(0) / Double(NSEC_PER_SEC)
|
|
||||||
let when = lastFireTime + Double(dispatchDelay) / Double(NSEC_PER_SEC)
|
|
||||||
if now >= when {
|
|
||||||
action()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
MeteorCollection provides basic persistence as well as an api for integrating SwiftDDP with persistence stores.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// MeteorCollectionType protocol declaration is necessary
|
|
||||||
open class MeteorCollection<T:MeteorDocument>: AbstractCollection {
|
|
||||||
|
|
||||||
let collectionSetDidChange = debounce(TimeInterval(0.33), queue: DispatchQueue.main, action: {
|
|
||||||
OperationQueue.main.addOperation() {
|
|
||||||
NotificationCenter.default.post(name: Notification.Name(rawValue: METEOR_COLLECTION_SET_DID_CHANGE), object: nil)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
var documents = [String:T]()
|
|
||||||
|
|
||||||
open var sorted:[T] {
|
|
||||||
return Array(documents.values).sorted(by: { $0._id > $1._id })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the number of documents in the collection
|
|
||||||
*/
|
|
||||||
|
|
||||||
open var count:Int {
|
|
||||||
return documents.count
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Initializes a MeteorCollection object
|
|
||||||
|
|
||||||
- parameter name: The string name of the collection (must match the name of the collection on the server)
|
|
||||||
*/
|
|
||||||
|
|
||||||
public override init(name: String) {
|
|
||||||
super.init(name: name)
|
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate func index(_ id: String) -> Int? {
|
|
||||||
return sorted.index(where: {item in item._id == id})
|
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate func sorted(_ property:String) -> [T] {
|
|
||||||
let values = Array(documents.values)
|
|
||||||
return values.sorted(by: { $0._id > $1._id })
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Find a single document by id
|
|
||||||
|
|
||||||
- parameter id: the id of the document
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func findOne(_ id: String) -> T? {
|
|
||||||
return documents[id]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Invoked when a document has been sent from the server.
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
- parameter fields: an optional NSDictionary with the documents properties
|
|
||||||
*/
|
|
||||||
|
|
||||||
open override func documentWasAdded(_ collection:String, id:String, fields:NSDictionary?) {
|
|
||||||
let document = T(id: id, fields: fields)
|
|
||||||
self.documents[id] = document
|
|
||||||
collectionSetDidChange()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Invoked when a document has been changed on the server.
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
- parameter fields: an optional NSDictionary with the documents properties
|
|
||||||
- parameter cleared: Optional array of strings (field names to delete)
|
|
||||||
*/
|
|
||||||
|
|
||||||
open override func documentWasChanged(_ collection:String, id:String, fields:NSDictionary?, cleared:[String]?) {
|
|
||||||
if let document = documents[id] {
|
|
||||||
document.update(fields, cleared: cleared)
|
|
||||||
self.documents[id] = document
|
|
||||||
collectionSetDidChange()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Invoked when a document has been removed on the server.
|
|
||||||
|
|
||||||
- parameter collection: the string name of the collection to which the document belongs
|
|
||||||
- parameter id: the string unique id that identifies the document on the server
|
|
||||||
*/
|
|
||||||
|
|
||||||
open override func documentWasRemoved(_ collection:String, id:String) {
|
|
||||||
if let _ = documents[id] {
|
|
||||||
self.documents[id] = nil
|
|
||||||
collectionSetDidChange()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Client-side method to insert a document
|
|
||||||
|
|
||||||
- parameter document: a document that inherits from MeteorDocument
|
|
||||||
*/
|
|
||||||
open func insert(_ document: T) {
|
|
||||||
|
|
||||||
documents[document._id] = document
|
|
||||||
collectionSetDidChange()
|
|
||||||
|
|
||||||
client.insert(self.name, document: [document.fields()]) { result, error in
|
|
||||||
|
|
||||||
if error != nil {
|
|
||||||
self.documents[document._id] = nil
|
|
||||||
self.collectionSetDidChange()
|
|
||||||
log.error("\(error!)")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Client-side method to update a document
|
|
||||||
|
|
||||||
- parameter document: a document that inherits from MeteorDocument
|
|
||||||
- parameter operation: a dictionary containing a Mongo selector and a json object
|
|
||||||
*/
|
|
||||||
|
|
||||||
open func update(_ document: T, withMongoOperation operation: [String:Any]) {
|
|
||||||
let originalDocument = documents[document._id]
|
|
||||||
|
|
||||||
documents[document._id] = document
|
|
||||||
collectionSetDidChange()
|
|
||||||
|
|
||||||
client.update(self.name, document: [["_id":document._id], operation]) { result, error in
|
|
||||||
|
|
||||||
if error != nil {
|
|
||||||
self.documents[document._id] = originalDocument
|
|
||||||
self.collectionSetDidChange()
|
|
||||||
log.error("\(error!)")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Client-side method to update a document
|
|
||||||
|
|
||||||
- parameter document: a document that inherits from MeteorDocument
|
|
||||||
*/
|
|
||||||
open func update(_ document: T) {
|
|
||||||
|
|
||||||
let originalDocument = documents[document._id]
|
|
||||||
|
|
||||||
documents[document._id] = document
|
|
||||||
collectionSetDidChange()
|
|
||||||
|
|
||||||
let fields = document.fields()
|
|
||||||
|
|
||||||
client.update(self.name, document: [["_id":document._id],["$set":fields]]) { result, error in
|
|
||||||
|
|
||||||
if error != nil {
|
|
||||||
self.documents[document._id] = originalDocument
|
|
||||||
self.collectionSetDidChange()
|
|
||||||
log.error("\(error!)")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Client-side method to remove a document
|
|
||||||
|
|
||||||
- parameter document: a document that inherits from MeteorDocument
|
|
||||||
*/
|
|
||||||
open func remove(_ document: T) {
|
|
||||||
documents[document._id] = nil
|
|
||||||
collectionSetDidChange()
|
|
||||||
|
|
||||||
client.remove(self.name, document: [["_id":document._id]]) { result, error in
|
|
||||||
|
|
||||||
if error != nil {
|
|
||||||
self.documents[document._id] = document
|
|
||||||
self.collectionSetDidChange()
|
|
||||||
log.error("\(error!)")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
// Copyright (c) 2016 Peter Siegesmund <peter.siegesmund@icloud.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
open class MeteorDocument: NSObject {
|
|
||||||
|
|
||||||
public var _id:String
|
|
||||||
|
|
||||||
required public init(id: String, fields: NSDictionary?) {
|
|
||||||
self._id = id
|
|
||||||
super.init()
|
|
||||||
if let properties = fields {
|
|
||||||
for (key,value) in properties {
|
|
||||||
if !(value is NSNull) {
|
|
||||||
self.setValue(value, forKey: key as! String)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open func update(_ fields: NSDictionary?, cleared: [String]?) {
|
|
||||||
if let properties = fields {
|
|
||||||
for (key,value) in properties {
|
|
||||||
print("Key: \(key), Value: \(value)")
|
|
||||||
self.setValue(value, forKey: key as! String)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let deletions = cleared {
|
|
||||||
for property in deletions {
|
|
||||||
self.setNilValueForKey(property)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Limitations to propertyNames:
|
|
||||||
- Returns an empty array for Objective-C objects
|
|
||||||
- Will not return computed properties, i.e.:
|
|
||||||
- If self is an instance of a class (vs., say, a struct), this doesn't report its superclass's properties, i.e.:
|
|
||||||
see http://stackoverflow.com/questions/24844681/list-of-classs-properties-in-swift
|
|
||||||
*/
|
|
||||||
|
|
||||||
public func propertyNames() -> [String] {
|
|
||||||
return Mirror(reflecting: self).children.filter { $0.label != nil }.map { $0.label! }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
This method should be public so users of this library can override it for parsing their variables in their MeteorDocument object when having structs and such in their Document.
|
|
||||||
*/
|
|
||||||
open func fields() -> NSDictionary {
|
|
||||||
let fieldsDict = NSMutableDictionary()
|
|
||||||
let properties = propertyNames()
|
|
||||||
|
|
||||||
for name in properties {
|
|
||||||
if var value = self.value(forKey: name) {
|
|
||||||
|
|
||||||
if value as? Date != nil {
|
|
||||||
value = EJSON.convertToEJSONDate(value as! Date)
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldsDict.setValue(value, forKey: name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldsDict.setValue(self._id, forKey: "_id")
|
|
||||||
print("fields \(fieldsDict)")
|
|
||||||
return fieldsDict as NSDictionary
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
//
|
|
||||||
// MeteorExtension.swift
|
|
||||||
// SwiftDDP
|
|
||||||
//
|
|
||||||
// Created by 市川雄二 on 2018/10/05.
|
|
||||||
// Copyright © 2018 Peter Siegesmund. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension Meteor {
|
|
||||||
internal static func loginWithService<T: UIViewController>(_ service: String, clientId: String, viewController: T) {
|
|
||||||
|
|
||||||
// Resume rather than
|
|
||||||
// if Meteor.client.loginWithToken(nil) == false {
|
|
||||||
// var url:String!
|
|
||||||
//
|
|
||||||
// switch service {
|
|
||||||
// case "twitter":
|
|
||||||
// url = MeteorOAuthServices.twitter()
|
|
||||||
//
|
|
||||||
// case "facebook":
|
|
||||||
// url = MeteorOAuthServices.facebook(clientId)
|
|
||||||
//
|
|
||||||
// case "github":
|
|
||||||
// url = MeteorOAuthServices.github(clientId)
|
|
||||||
//
|
|
||||||
// case "google":
|
|
||||||
// url = MeteorOAuthServices.google(clientId)
|
|
||||||
//
|
|
||||||
// default:
|
|
||||||
// url = nil
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// let oauthDialog = MeteorOAuthDialogViewController()
|
|
||||||
// oauthDialog.serviceName = service.capitalizedString
|
|
||||||
// oauthDialog.url = NSURL(string: url)
|
|
||||||
// viewController.presentViewController(oauthDialog, animated: true, completion: nil)
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// log.debug("Already have valid server login credentials. Logging in with preexisting login token")
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using Twitter
|
|
||||||
|
|
||||||
- parameter viewController: A view controller from which to launch the OAuth modal dialog
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func loginWithTwitter<T: UIViewController>(_ viewController: T) {
|
|
||||||
Meteor.loginWithService("twitter", clientId: "", viewController: viewController)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using Facebook
|
|
||||||
|
|
||||||
- parameter viewController: A view controller from which to launch the OAuth modal dialog
|
|
||||||
- parameter clientId: The apps client id, provided by the service (Facebook, Google, etc.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func loginWithFacebook<T: UIViewController>(_ clientId: String, viewController: T) {
|
|
||||||
Meteor.loginWithService("facebook", clientId: clientId, viewController: viewController)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using Github
|
|
||||||
|
|
||||||
- parameter viewController: A view controller from which to launch the OAuth modal dialog
|
|
||||||
- parameter clientId: The apps client id, provided by the service (Facebook, Google, etc.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func loginWithGithub<T: UIViewController>(_ clientId: String, viewController: T) {
|
|
||||||
Meteor.loginWithService("github", clientId: clientId, viewController: viewController)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Logs a user into the server using Google
|
|
||||||
|
|
||||||
- parameter viewController: A view controller from which to launch the OAuth modal dialog
|
|
||||||
- parameter clientId: The apps client id, provided by the service (Facebook, Google, etc.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
open static func loginWithGoogle<T: UIViewController>(_ clientId: String, viewController: T) {
|
|
||||||
Meteor.loginWithService("google", clientId: clientId, viewController: viewController)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,293 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Structs Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="js/jquery.min.js" defer></script>
|
||||||
|
<script src="js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a title="Structs Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="img/carat.png" />
|
||||||
|
Structs Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>Structs</h1>
|
||||||
|
<p>The following structs are available globally.</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:V8SwiftDDP10Completion"></a>
|
||||||
|
<a name="//apple_ref/swift/Struct/Completion" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Completion is a wrapper for DDP callbacks that ensures that callbacks are executed
|
||||||
|
on the same queue on which the original method was called. If the current queue is
|
||||||
|
not available, execution defaults to the main queue.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Completion</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:V8SwiftDDP6Result"></a>
|
||||||
|
<a name="//apple_ref/swift/Struct/Result" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:V8SwiftDDP6Result">Result</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Struct to encapsulate the result of a Meteor method call</p>
|
||||||
|
|
||||||
|
<a href="Structs/Result.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Result</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:V8SwiftDDP10DDPMessage"></a>
|
||||||
|
<a name="//apple_ref/swift/Struct/DDPMessage" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:V8SwiftDDP10DDPMessage">DDPMessage</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>A struct to parse, encapsulate and facilitate handling of DDP message strings</p>
|
||||||
|
|
||||||
|
<a href="Structs/DDPMessage.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DDPMessage</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:V8SwiftDDP8DDPError"></a>
|
||||||
|
<a name="//apple_ref/swift/Struct/DDPError" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:V8SwiftDDP8DDPError">DDPError</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>A struct encapsulating a DDP error message</p>
|
||||||
|
|
||||||
|
<a href="Structs/DDPError.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DDPError</span><span class="p">:</span> <span class="kt">ErrorType</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:V8SwiftDDP9DDPEvents"></a>
|
||||||
|
<a name="//apple_ref/swift/Struct/DDPEvents" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:V8SwiftDDP9DDPEvents">DDPEvents</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>DDPEvents is a struct holder for callback closures that execute in response to
|
||||||
|
websocket and Meteor lifecyle events. New closures can be assigned to public
|
||||||
|
closures to modify the clients behavior in response to the trigger event.</p>
|
||||||
|
|
||||||
|
<a href="Structs/DDPEvents.html" class="slightly-smaller">See more</a>
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DDPEvents</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,253 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>DDPError Struct Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Struct/DDPError" class="dashAnchor"></a>
|
||||||
|
<a title="DDPError Struct Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
DDPError Struct Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>DDPError</h1>
|
||||||
|
<div class="declaration">
|
||||||
|
<div class="language">
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DDPError</span><span class="p">:</span> <span class="kt">ErrorType</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>A struct encapsulating a DDP error message</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP8DDPError5errorGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/error" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP8DDPError5errorGSqSS_">error</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The string error code</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">error</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span> <span class="p">{</span> <span class="k">return</span> <span class="n">json</span><span class="p">?[</span><span class="s">"error"</span><span class="p">]</span> <span class="k">as?</span> <span class="kt">String</span> <span class="p">}</span> <span class="c1">// Error code</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP8DDPError6reasonGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/reason" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP8DDPError6reasonGSqSS_">reason</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The detailed message given for an error returned from the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">reason</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span> <span class="p">{</span> <span class="k">return</span> <span class="n">json</span><span class="p">?[</span><span class="s">"reason"</span><span class="p">]</span> <span class="k">as?</span> <span class="kt">String</span> <span class="p">}</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP8DDPError7detailsGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/details" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP8DDPError7detailsGSqSS_">details</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The string providing error details</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">details</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span> <span class="p">{</span> <span class="k">return</span> <span class="n">json</span><span class="p">?[</span><span class="s">"details"</span><span class="p">]</span> <span class="k">as?</span> <span class="kt">String</span> <span class="p">}</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP8DDPError16offendingMessageGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/offendingMessage" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP8DDPError16offendingMessageGSqSS_">offendingMessage</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>If the original message parsed properly, it is included here</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">offendingMessage</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span> <span class="p">{</span> <span class="k">return</span> <span class="n">json</span><span class="p">?[</span><span class="s">"offendingMessage"</span><span class="p">]</span> <span class="k">as?</span> <span class="kt">String</span> <span class="p">}</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,542 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>DDPEvents Struct Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Struct/DDPEvents" class="dashAnchor"></a>
|
||||||
|
<a title="DDPEvents Struct Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
DDPEvents Struct Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>DDPEvents</h1>
|
||||||
|
<div class="declaration">
|
||||||
|
<div class="language">
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DDPEvents</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>DDPEvents is a struct holder for callback closures that execute in response to
|
||||||
|
websocket and Meteor lifecyle events. New closures can be assigned to public
|
||||||
|
closures to modify the clients behavior in response to the trigger event.</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP9DDPEvents11onConnectedVS_10Completion"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/onConnected" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP9DDPEvents11onConnectedVS_10Completion">onConnected</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DDPEvents</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP9DDPEvents14onDisconnectedFT_T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/onDisconnected" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP9DDPEvents14onDisconnectedFT_T_">onDisconnected</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>onDisconnected executes when the client is disconnected</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onDisconnected</span><span class="p">:</span> <span class="p">()</span> <span class="o">-></span> <span class="p">()</span> <span class="o">=</span> <span class="p">{</span><span class="n">log</span><span class="o">.</span><span class="nf">debug</span><span class="p">(</span><span class="s">"disconnected"</span><span class="p">)}</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP9DDPEvents8onFailedFT_T_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/onFailed" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP9DDPEvents8onFailedFT_T_">onFailed</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>onFailed executes when an attempt to make a DDP connection fails</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onFailed</span><span class="p">:</span> <span class="p">()</span> <span class="o">-></span> <span class="p">()</span> <span class="o">=</span> <span class="p">{</span><span class="n">log</span><span class="o">.</span><span class="nf">error</span><span class="p">(</span><span class="s">"failed"</span><span class="p">)}</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP9DDPEvents7onAddedGSqFT10collectionSS2idSS6fieldsGSqCSo12NSDictionary__T__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/onAdded" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP9DDPEvents7onAddedGSqFT10collectionSS2idSS6fieldsGSqCSo12NSDictionary__T__">onAdded</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>onAdded executes when a document has been added to a local collection</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onAdded</span><span class="p">:</span> <span class="p">((</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?)</span> <span class="o">-></span> <span class="p">())?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>fields</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional NSDictionary with the documents properties</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP9DDPEvents9onChangedGSqFT10collectionSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqCSo7NSArray__T__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/onChanged" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP9DDPEvents9onChangedGSqFT10collectionSS2idSS6fieldsGSqCSo12NSDictionary_7clearedGSqCSo7NSArray__T__">onChanged</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>onChanged executes when the server sends an instruction to modify a local document</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onChanged</span><span class="p">:</span> <span class="p">((</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?,</span> <span class="nv">cleared</span><span class="p">:</span><span class="kt">NSArray</span><span class="p">?)</span> <span class="o">-></span> <span class="p">())?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>fields</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional NSDictionary with the documents properties</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>cleared</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>an optional array of string property names to delete</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP9DDPEvents9onRemovedGSqFT10collectionSS2idSS_T__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/onRemoved" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP9DDPEvents9onRemovedGSqFT10collectionSS2idSS_T__">onRemoved</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>onRemoved executes when the server sends an instruction to remove a document from the local collection</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onRemoved</span><span class="p">:</span> <span class="p">((</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="p">())?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>collection</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string name of the collection to which the document belongs</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>id</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>the string unique id that identifies the document on the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP9DDPEvents9onUpdatedGSqFT7methodsGSaSS__T__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/onUpdated" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP9DDPEvents9onUpdatedGSqFT7methodsGSaSS__T__">onUpdated</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>onUpdated executes when the server sends a notification that all the consequences of a method call have
|
||||||
|
been communicated to the client</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onUpdated</span><span class="p">:</span> <span class="p">((</span><span class="nv">methods</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">])</span> <span class="o">-></span> <span class="p">())?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>methods</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>An array of method id strings</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP9DDPEvents7onErrorGSqFT7messageVS_8DDPError_T__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/onError" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP9DDPEvents7onErrorGSqFT7messageVS_8DDPError_T__">onError</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>onError executes when the client receives a DDP error message</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onError</span><span class="p">:</span> <span class="p">((</span><span class="nv">message</span><span class="p">:</span><span class="kt">DDPError</span><span class="p">)</span> <span class="o">-></span> <span class="p">())?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<table class="graybox">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>
|
||||||
|
<em>message</em>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<p>A DDPError message describing the error</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,820 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>DDPMessage Struct Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Struct/DDPMessage" class="dashAnchor"></a>
|
||||||
|
<a title="DDPMessage Struct Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
DDPMessage Struct Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>DDPMessage</h1>
|
||||||
|
<div class="declaration">
|
||||||
|
<div class="language">
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DDPMessage</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>A struct to parse, encapsulate and facilitate handling of DDP message strings</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage4jsonGSQCSo12NSDictionary_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/json" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage4jsonGSQCSo12NSDictionary_">json</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The message’s properties, stored as an NSDictionary</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">json</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="o">!</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FV8SwiftDDP10DDPMessagecFT7messageSS_S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/init(message:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FV8SwiftDDP10DDPMessagecFT7messageSS_S0_">init(message:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Initialize a message struct, with a Json string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">message</span><span class="p">:</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FV8SwiftDDP10DDPMessagecFT7messageGVs10DictionarySSSS__S0_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/init(message:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FV8SwiftDDP10DDPMessagecFT7messageGVs10DictionarySSSS__S0_">init(message:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Initialize a message struct, with a dictionary of strings</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">message</span><span class="p">:[</span><span class="kt">String</span><span class="p">:</span><span class="kt">String</span><span class="p">])</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:ZFV8SwiftDDP10DDPMessage8toStringFPs9AnyObject_GSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/toString(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:ZFV8SwiftDDP10DDPMessage8toStringFPs9AnyObject_GSqSS_">toString(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Converts an NSDictionary to a JSON string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">toString</span><span class="p">(</span><span class="nv">json</span><span class="p">:</span><span class="kt">AnyObject</span><span class="p">)</span> <span class="o">-></span> <span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage4typeOS_14DDPMessageType"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage4typeOS_14DDPMessageType">type</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Returns the DDP message type, of type DDPMessageType enum</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span><span class="kt">DDPMessageType</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage7isErrorSb"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/isError" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage7isErrorSb">isError</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Returns a boolean value indicating if the message is an error message or not</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">isError</span><span class="p">:</span><span class="kt">Bool</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:FV8SwiftDDP10DDPMessage11hasPropertyFSSSb"></a>
|
||||||
|
<a name="//apple_ref/swift/Method/hasProperty(_:)" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:FV8SwiftDDP10DDPMessage11hasPropertyFSSSb">hasProperty(_:)</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>Undocumented</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DDPMessage</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage7messageGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/message" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage7messageGSqSS_">message</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP message</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">message</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage7sessionGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/session" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage7sessionGSqSS_">session</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP session string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">session</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage7versionGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/version" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage7versionGSqSS_">version</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP version string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">version</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage7supportGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/support" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage7supportGSqSS_">support</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP support string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">support</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage2idGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage2idGSqSS_">id</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP message id string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage4nameGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/name" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage4nameGSqSS_">name</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP name string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">name</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage6paramsGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/params" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage6paramsGSqSS_">params</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP param string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">params</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage5errorGSqVS_8DDPError_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/error" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage5errorGSqVS_8DDPError_">error</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP error object</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">error</span><span class="p">:</span><span class="kt">DDPError</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage10collectionGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/collection" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage10collectionGSqSS_">collection</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP collection name string</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage6fieldsGSqCSo12NSDictionary_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/fields" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage6fieldsGSqCSo12NSDictionary_">fields</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP fields dictionary</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage7clearedGSqGSaSS__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/cleared" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage7clearedGSqGSaSS__">cleared</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional DDP cleared array. Contains an array of fields that should be removed</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">cleared</span><span class="p">:[</span><span class="kt">String</span><span class="p">]?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage6methodGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/method" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage6methodGSqSS_">method</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional method name</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">method</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage10randomSeedGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/randomSeed" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage10randomSeedGSqSS_">randomSeed</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional random seed JSON value (an arbitrary client-determined seed for pseudo-random generators)</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">randomSeed</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage6resultGSqPs9AnyObject__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/result" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage6resultGSqPs9AnyObject__">result</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional result object, containing the result of a method call</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">result</span><span class="p">:</span><span class="kt">AnyObject</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage7methodsGSqGSaSS__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/methods" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage7methodsGSqGSaSS__">methods</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional array of ids passed to ‘method’, all of whose writes have been reflected in data messages)</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">methods</span><span class="p">:[</span><span class="kt">String</span><span class="p">]?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage4subsGSqGSaSS__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/subs" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage4subsGSqGSaSS__">subs</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional array of id strings passed to ‘sub’ which have sent their initial batch of data</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">subs</span><span class="p">:[</span><span class="kt">String</span><span class="p">]?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage6reasonGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/reason" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage6reasonGSqSS_">reason</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional reason given for an error returned from the server</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">reason</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP10DDPMessage16offendingMessageGSqSS_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/offendingMessage" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP10DDPMessage16offendingMessageGSqSS_">offendingMessage</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The optional original error message</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">offendingMessage</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,199 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Result Struct Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="../js/jquery.min.js" defer></script>
|
||||||
|
<script src="../js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="//apple_ref/swift/Struct/Result" class="dashAnchor"></a>
|
||||||
|
<a title="Result Struct Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="../index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="../index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="../img/carat.png" />
|
||||||
|
Result Struct Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="../Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="../Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
<h1>Result</h1>
|
||||||
|
<div class="declaration">
|
||||||
|
<div class="language">
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Result</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>Struct to encapsulate the result of a Meteor method call</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="section task-group-section">
|
||||||
|
<div class="task-group">
|
||||||
|
<ul>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP6Result6resultGSqPs9AnyObject__"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/result" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP6Result6resultGSqPs9AnyObject__">result</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>The result of the method call</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">result</span><span class="p">:</span><span class="kt">AnyObject</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="item">
|
||||||
|
<div>
|
||||||
|
<code>
|
||||||
|
<a name="/s:vV8SwiftDDP6Result5errorGSqVS_8DDPError_"></a>
|
||||||
|
<a name="//apple_ref/swift/Property/error" class="dashAnchor"></a>
|
||||||
|
<a class="token" href="#/s:vV8SwiftDDP6Result5errorGSqVS_8DDPError_">error</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<div class="height-container">
|
||||||
|
<div class="pointer-container"></div>
|
||||||
|
<section class="section">
|
||||||
|
<div class="pointer"></div>
|
||||||
|
<div class="abstract">
|
||||||
|
<p>An error object describing the server-side error, or nil if the method completed successfully</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="declaration">
|
||||||
|
<h4>Declaration</h4>
|
||||||
|
<div class="language">
|
||||||
|
<p class="aside-title">Swift</p>
|
||||||
|
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">error</span><span class="p">:</span><span class="kt">DDPError</span><span class="p">?</span></code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>$(PRODUCT_NAME)</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>FMWK</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>Copyright © 2016 Peter Siegesmund. All rights reserved.</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string></string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,19 +0,0 @@
|
||||||
//
|
|
||||||
// SwiftDDP-OSX.h
|
|
||||||
// SwiftDDP-OSX
|
|
||||||
//
|
|
||||||
// Created by ebond on 8/22/16.
|
|
||||||
// Copyright © 2016 Peter Siegesmund. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
//! Project version number for SwiftDDP-OSX.
|
|
||||||
FOUNDATION_EXPORT double SwiftDDP_OSXVersionNumber;
|
|
||||||
|
|
||||||
//! Project version string for SwiftDDP-OSX.
|
|
||||||
FOUNDATION_EXPORT const unsigned char SwiftDDP_OSXVersionString[];
|
|
||||||
|
|
||||||
// In this header, you should import all the public headers of your framework using statements like #import <SwiftDDP_OSX/PublicHeader.h>
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>$(PRODUCT_NAME)</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>FMWK</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string></string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,19 +0,0 @@
|
||||||
//
|
|
||||||
// SwiftDDP-tvOS.h
|
|
||||||
// SwiftDDP-tvOS
|
|
||||||
//
|
|
||||||
// Created by ebond on 8/22/16.
|
|
||||||
// Copyright © 2016 Peter Siegesmund. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
|
|
||||||
//! Project version number for SwiftDDP-tvOS.
|
|
||||||
FOUNDATION_EXPORT double SwiftDDP_tvOSVersionNumber;
|
|
||||||
|
|
||||||
//! Project version string for SwiftDDP-tvOS.
|
|
||||||
FOUNDATION_EXPORT const unsigned char SwiftDDP_tvOSVersionString[];
|
|
||||||
|
|
||||||
// In this header, you should import all the public headers of your framework using statements like #import <SwiftDDP_tvOS/PublicHeader.h>
|
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
Pod::Spec.new do |s|
|
|
||||||
s.name = "SwiftDDP"
|
|
||||||
s.version = "0.4.2"
|
|
||||||
s.summary = "A DDP Client for communicating with Meteor servers, written in Swift. Supports OAuth login with Facebook, Google, Twitter & Github."
|
|
||||||
|
|
||||||
s.description = <<-DESC "A DDP Client for communicating with DDP Servers (Meteor JS), written in Swift. Supports OAuth authentication with Facebook, Google, Twitter & Github."
|
|
||||||
DESC
|
|
||||||
|
|
||||||
s.homepage = "https://github.com/siegesmund/SwiftDDP"
|
|
||||||
s.license = 'MIT'
|
|
||||||
s.author = { "Peter Siegesmund" => "peter.siegesmund@icloud.com" }
|
|
||||||
s.source = { :git => "https://github.com/siegesmund/SwiftDDP.git", :tag => s.version.to_s }
|
|
||||||
s.social_media_url = 'https://twitter.com/psiegesmund'
|
|
||||||
|
|
||||||
s.requires_arc = true
|
|
||||||
s.platform = :ios, '8.1'
|
|
||||||
s.source_files = 'Sources/*.swift'
|
|
||||||
|
|
||||||
s.dependency 'CryptoSwift'
|
|
||||||
s.dependency 'SwiftWebSocket'
|
|
||||||
s.dependency 'XCGLogger'
|
|
||||||
|
|
||||||
end
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Workspace
|
|
||||||
version = "1.0">
|
|
||||||
<FileRef
|
|
||||||
location = "self:">
|
|
||||||
</FileRef>
|
|
||||||
</Workspace>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "8EA5B47AAF181A89417DB4A5B2BB211FCF91F09F",
|
|
||||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
|
|
||||||
|
|
||||||
},
|
|
||||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
|
|
||||||
"4E2F5E824C021282D3F5789E108FCDC580F66A19" : 0,
|
|
||||||
"8EA5B47AAF181A89417DB4A5B2BB211FCF91F09F" : 0,
|
|
||||||
"A04CE38E120D206E17F2FC722F8875D9EA7A7FBA" : 0
|
|
||||||
},
|
|
||||||
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "61406E4F-759F-45A7-95EF-FD1785A38B4D",
|
|
||||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
|
|
||||||
"4E2F5E824C021282D3F5789E108FCDC580F66A19" : "SwiftDDP\/Dollar.swift\/",
|
|
||||||
"8EA5B47AAF181A89417DB4A5B2BB211FCF91F09F" : "SwiftDDP\/",
|
|
||||||
"A04CE38E120D206E17F2FC722F8875D9EA7A7FBA" : ""
|
|
||||||
},
|
|
||||||
"DVTSourceControlWorkspaceBlueprintNameKey" : "SwiftDDP",
|
|
||||||
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
|
|
||||||
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "SwiftDDP.xcodeproj",
|
|
||||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
|
|
||||||
{
|
|
||||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/siegesmund\/SwiftDDP.git",
|
|
||||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
|
||||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "8EA5B47AAF181A89417DB4A5B2BB211FCF91F09F"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/siegesmund\/SwiftTodos.git",
|
|
||||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
|
||||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "A04CE38E120D206E17F2FC722F8875D9EA7A7FBA"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "0730"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "AA0D2AC21D6BEEC700085B33"
|
|
||||||
BuildableName = "SwiftDDP.framework"
|
|
||||||
BlueprintName = "SwiftDDP-tvOS"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
</Testables>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "AA0D2AC21D6BEEC700085B33"
|
|
||||||
BuildableName = "SwiftDDP.framework"
|
|
||||||
BlueprintName = "SwiftDDP-tvOS"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "AA0D2AC21D6BEEC700085B33"
|
|
||||||
BuildableName = "SwiftDDP.framework"
|
|
||||||
BlueprintName = "SwiftDDP-tvOS"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
|
@ -1,99 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "0700"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "D02A71DB1BBEFBCA00940C17"
|
|
||||||
BuildableName = "SwiftDDP.framework"
|
|
||||||
BlueprintName = "SwiftDDP"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
<TestableReference
|
|
||||||
skipped = "NO">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "D02A72521BBF07AF00940C17"
|
|
||||||
BuildableName = "SwiftDDP Tests.xctest"
|
|
||||||
BlueprintName = "SwiftDDP Tests"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</TestableReference>
|
|
||||||
</Testables>
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "D02A71DB1BBEFBCA00940C17"
|
|
||||||
BuildableName = "SwiftDDP.framework"
|
|
||||||
BlueprintName = "SwiftDDP"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "D02A71DB1BBEFBCA00940C17"
|
|
||||||
BuildableName = "SwiftDDP.framework"
|
|
||||||
BlueprintName = "SwiftDDP"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "D02A71DB1BBEFBCA00940C17"
|
|
||||||
BuildableName = "SwiftDDP.framework"
|
|
||||||
BlueprintName = "SwiftDDP"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
|
@ -1,69 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "0700"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForTesting = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "D02A72521BBF07AF00940C17"
|
|
||||||
BuildableName = "SwiftDDP Tests.xctest"
|
|
||||||
BlueprintName = "SwiftDDP Tests"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
<TestableReference
|
|
||||||
skipped = "NO">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "D02A72521BBF07AF00940C17"
|
|
||||||
BuildableName = "SwiftDDP Tests.xctest"
|
|
||||||
BlueprintName = "SwiftDDP Tests"
|
|
||||||
ReferencedContainer = "container:SwiftDDP.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</TestableReference>
|
|
||||||
</Testables>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
|
@ -1,57 +0,0 @@
|
||||||
|
|
||||||
import Foundation
|
|
||||||
@testable import SwiftDDP
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Test Data
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
class Document: MeteorDocument {
|
|
||||||
|
|
||||||
var state:String?
|
|
||||||
var city:String?
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** methods that are tested against a server are tested against the url below ***
|
|
||||||
|
|
||||||
//let url = "ws://swiftddp.meteor.com/websocket"
|
|
||||||
let url = "ws://localhost:3000/websocket"
|
|
||||||
let user = "mjgaylord@gmail.com"
|
|
||||||
let pass = "mjgaylord123"
|
|
||||||
|
|
||||||
let ready = DDPMessage(message: "{\"msg\":\"ready\", \"subs\":[\"AllStates\"]}")
|
|
||||||
let nosub = DDPMessage(message: ["msg":"nosub", "id":"AllStates"])
|
|
||||||
|
|
||||||
let added = [DDPMessage(message: "{\"collection\" : \"test-collection\", \"id\" : \"2gAMzqvE8K8kBWK8F\", \"fields\" : {\"state\" : \"MA\", \"city\" : \"Boston\"}, \"msg\" : \"added\"}"),
|
|
||||||
DDPMessage(message:"{\"collection\" : \"test-collection\", \"id\" : \"ByuwhKPGuLru8h4TT\", \"fields\" : {\"state\" : \"MA\", \"city\" : \"Truro\"}, \"msg\" : \"added\"}"),
|
|
||||||
DDPMessage(message:"{\"collection\" : \"test-collection\", \"id\" : \"AGX6vyxCJtjqdxbFH\", \"fields\" : {\"state\" : \"TX\", \"city\" : \"Austin\"}, \"msg\" : \"added\"}")]
|
|
||||||
|
|
||||||
let removed = [DDPMessage(message: ["msg" : "removed", "id" : "2gAMzqvE8K8kBWK8F","collection" : "test-collection"]),
|
|
||||||
DDPMessage(message: ["msg" : "removed", "id" : "ByuwhKPGuLru8h4TT", "collection" : "test-collection"]),
|
|
||||||
DDPMessage(message:["msg" : "removed", "id" : "AGX6vyxCJtjqdxbFH", "collection" : "test-collection"])]
|
|
||||||
|
|
||||||
let changed = [DDPMessage(message: "{\"collection\" : \"test-collection\", \"id\" : \"2gAMzqvE8K8kBWK8F\",\"cleared\" : [\"city\"], \"fields\" : {\"state\" : \"MA\", \"city\" : \"Amherst\"}, \"msg\" : \"changed\"}"),
|
|
||||||
DDPMessage(message:"{\"collection\" : \"test-collection\", \"id\" : \"ByuwhKPGuLru8h4TT\", \"fields\" : {\"state\" : \"MA\", \"city\" : \"Cambridge\"}, \"msg\" : \"changed\"}"),
|
|
||||||
DDPMessage(message:"{\"collection\" : \"test-collection\", \"id\" : \"AGX6vyxCJtjqdxbFH\", \"fields\" : {\"state\" : \"TX\", \"city\" : \"Houston\"}, \"msg\" : \"changed\"}")]
|
|
||||||
|
|
||||||
let userAddedWithPassword = DDPMessage(message: "{\"collection\" : \"users\", \"id\" : \"123456abcdefg\", \"fields\" : {\"roles\" : [\"admin\"], \"emails\" : [{\"address\" : \"test@user.com\", \"verified\" : false}], \"username\" : \"test\"}, \"msg\" : \"added\"}")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let addedRealm = [DDPMessage(message: "{\"collection\" : \"Cities\", \"id\" : \"2gAMzqvE8K8kBWK8F\", \"fields\" : {\"state\" : \"MA\", \"city\" : \"Boston\"}, \"msg\" : \"added\"}"),
|
|
||||||
DDPMessage(message:"{\"collection\" : \"Cities\", \"id\" : \"ByuwhKPGuLru8h4TT\", \"fields\" : {\"state\" : \"MA\", \"city\" : \"Truro\"}, \"msg\" : \"added\"}"),
|
|
||||||
DDPMessage(message:"{\"collection\" : \"Cities\", \"id\" : \"AGX6vyxCJtjqdxbFH\", \"fields\" : {\"state\" : \"TX\", \"city\" : \"Austin\"}, \"msg\" : \"added\"}")]
|
|
||||||
|
|
||||||
let removedRealm = [DDPMessage(message: ["msg" : "removed", "id" : "2gAMzqvE8K8kBWK8F","collection" : "Cities"]),
|
|
||||||
DDPMessage(message: ["msg" : "removed", "id" : "ByuwhKPGuLru8h4TT", "collection" : "Cities"]),
|
|
||||||
DDPMessage(message:["msg" : "removed", "id" : "AGX6vyxCJtjqdxbFH", "collection" : "Cities"])]
|
|
||||||
|
|
||||||
|
|
||||||
let changedRealm = [DDPMessage(message: "{\"collection\" : \"Cities\", \"id\" : \"2gAMzqvE8K8kBWK8F\",\"cleared\" : [\"city\"], \"fields\" : {\"state\" : \"MA\", \"city\" : \"Amherst\"}, \"msg\" : \"changed\"}"),
|
|
||||||
DDPMessage(message:"{\"collection\" : \"Cities\", \"id\" : \"ByuwhKPGuLru8h4TT\", \"fields\" : {\"state\" : \"MA\", \"city\" : \"Cambridge\"}, \"msg\" : \"changed\"}"),
|
|
||||||
DDPMessage(message:"{\"collection\" : \"Cities\", \"id\" : \"AGX6vyxCJtjqdxbFH\", \"fields\" : {\"state\" : \"TX\", \"city\" : \"Houston\"}, \"msg\" : \"changed\"}")]
|
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>$(PRODUCT_NAME)</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>BNDL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,315 +0,0 @@
|
||||||
import Quick
|
|
||||||
import Nimble
|
|
||||||
@testable import SwiftDDP
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Test Classes
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
class DDPMessageTest:QuickSpec {
|
|
||||||
override func spec() {
|
|
||||||
|
|
||||||
describe ("DDPMessage") {
|
|
||||||
|
|
||||||
it ("can be created from a Dictionary") {
|
|
||||||
let message = DDPMessage(message: ["msg":"test", "id":"test100"])
|
|
||||||
expect(message.hasProperty("msg")).to(beTrue())
|
|
||||||
expect(message.hasProperty("id")).to(beTruthy())
|
|
||||||
expect(message.id!).to(equal("test100"))
|
|
||||||
expect(message.message!).to(equal("test"))
|
|
||||||
}
|
|
||||||
|
|
||||||
it ("can be created from a String") {
|
|
||||||
let message = DDPMessage(message: "{\"msg\":\"test\", \"id\":\"test100\"}")
|
|
||||||
expect(message.hasProperty("msg")).to(beTruthy())
|
|
||||||
expect(message.hasProperty("id")).to(beTruthy())
|
|
||||||
expect(message.id!).to(equal("test100"))
|
|
||||||
expect(message.message!).to(equal("test"))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
it ("handles malformed json without crashing") {
|
|
||||||
let message = DDPMessage(message: "{\"msg\":\"test\", \"id\"test100\"}")
|
|
||||||
expect(message.isError).to(beTrue())
|
|
||||||
expect(message.reason!).to(equal("SwiftDDP JSON serialization error."))
|
|
||||||
}
|
|
||||||
|
|
||||||
it ("Sends malformed json to the error handler callback") {
|
|
||||||
|
|
||||||
var error:DDPError!
|
|
||||||
|
|
||||||
let client = DDPClient()
|
|
||||||
client.events.onError = {e in error = e }
|
|
||||||
let message = DDPMessage(message: "{\"msg\":\"test\", \"id\"test100\"}")
|
|
||||||
try! client.ddpMessageHandler(message)
|
|
||||||
|
|
||||||
expect(message.isError).to(beTrue())
|
|
||||||
expect(message.reason!).to(equal("SwiftDDP JSON serialization error."))
|
|
||||||
|
|
||||||
expect(error).toEventuallyNot(beNil())
|
|
||||||
expect(error.isValid).toEventually(beTrue())
|
|
||||||
expect(error.reason!).to(equal("SwiftDDP JSON serialization error."))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
describe ("DDPMessageHandler routing") {
|
|
||||||
|
|
||||||
it ("can handle an 'added' message"){
|
|
||||||
let client = DDPClient()
|
|
||||||
client.events.onAdded = {collection, id, fields in
|
|
||||||
expect(collection).to(equal("test-collection"))
|
|
||||||
expect(id).to(equal("2gAMzqvE8K8kBWK8F"))
|
|
||||||
let city = fields!["city"]! as! String
|
|
||||||
expect(city).to(equal("Boston"))
|
|
||||||
}
|
|
||||||
try! client.ddpMessageHandler(added[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
it ("can handle a 'removed' message") {
|
|
||||||
let client = DDPClient()
|
|
||||||
client.events.onRemoved = {collection, id in
|
|
||||||
expect(collection).to(equal("test-collection"))
|
|
||||||
expect(id).to(equal("2gAMzqvE8K8kBWK8F"))
|
|
||||||
}
|
|
||||||
try! client.ddpMessageHandler(removed[0])
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
it ("can handle a result message that returns a value") {
|
|
||||||
var value:String!
|
|
||||||
var r:AnyObject?
|
|
||||||
var e:DDPError?
|
|
||||||
|
|
||||||
let client = DDPClient()
|
|
||||||
client.resultCallbacks["1"] = {(result:AnyObject?, error:DDPError?) -> () in
|
|
||||||
value = result as! String
|
|
||||||
r = result
|
|
||||||
e = error
|
|
||||||
}
|
|
||||||
|
|
||||||
try! client.ddpMessageHandler(DDPMessage(message: ["id":"1", "msg":"result", "result":"test123"]))
|
|
||||||
expect(r).toEventuallyNot(beNil())
|
|
||||||
expect(e).to(beNil())
|
|
||||||
expect(value).toEventually(equal("test123"))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
it ("can handle a result message that does not return a value") {
|
|
||||||
var value:String!
|
|
||||||
var r:AnyObject?
|
|
||||||
var e:DDPError?
|
|
||||||
|
|
||||||
let client = DDPClient()
|
|
||||||
client.resultCallbacks["1"] = {(result:AnyObject?, error:DDPError?) -> ()
|
|
||||||
in if let v = result as? String { value = v }
|
|
||||||
r = result
|
|
||||||
e = error
|
|
||||||
}
|
|
||||||
|
|
||||||
try! client.ddpMessageHandler(DDPMessage(message: ["id":"1", "msg":"result"]))
|
|
||||||
expect(value).to(beNil())
|
|
||||||
expect(r).to(beNil())
|
|
||||||
expect(e).to(beNil())
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MeteorCollectionTests:QuickSpec {
|
|
||||||
override func spec() {
|
|
||||||
it ("Handle null values in the Dictionary, while parsing as a MeteorDocument") {
|
|
||||||
let collection = MeteorCollection<TestModel>(name: "testCollection")
|
|
||||||
|
|
||||||
let message = DDPMessage(message: "{\"id\":\"testId\", \"msg\":\"test message\", \"optional\":<null>}")
|
|
||||||
|
|
||||||
collection.documentWasAdded("testCollection", id: message.id!, fields: message.fields)
|
|
||||||
|
|
||||||
print("Message added into the collection: \(collection)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class TestModel:MeteorDocument {
|
|
||||||
var msg: String?
|
|
||||||
var optional: String?
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests against a Meteor instance at swiftddp.meteor.com
|
|
||||||
class DDPServerTests:QuickSpec {
|
|
||||||
override func spec() {
|
|
||||||
|
|
||||||
describe ("DDP Connection") {
|
|
||||||
|
|
||||||
it ("can connect to a DDP server"){
|
|
||||||
var testSession:String?
|
|
||||||
let client = DDPClient()
|
|
||||||
client.connect(url) { session in testSession = session }
|
|
||||||
expect(client.connection.ddp).toEventually(beTrue(), timeout:5)
|
|
||||||
expect(client.connection.session).toEventually(equal(testSession), timeout:5)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DDP Methods
|
|
||||||
// tests login:, logout:, insert:, remove:, update:
|
|
||||||
describe ("DDP Methods") {
|
|
||||||
|
|
||||||
it ("can login to a Meteor server") {
|
|
||||||
|
|
||||||
// On connect, the client should set the client.connection.session property
|
|
||||||
// After logging in with a username and password, the client should receive a result
|
|
||||||
// object that the session token
|
|
||||||
|
|
||||||
var testResult:NSDictionary!
|
|
||||||
var testSession:String!
|
|
||||||
|
|
||||||
let client = DDPClient()
|
|
||||||
client.connect(url) { session in
|
|
||||||
testSession = session
|
|
||||||
client.loginWithPassword(user, password: pass) { result, e in
|
|
||||||
testResult = result! as! NSDictionary
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Both of these should be non nil; the callbacks should assign them their respective values
|
|
||||||
expect(testResult).toEventuallyNot(beNil(), timeout:5)
|
|
||||||
expect(testSession).toEventuallyNot(beNil(), timeout:5)
|
|
||||||
|
|
||||||
let userDefaultsToken = client.userData.object(forKey: "DDP_TOKEN") as! String
|
|
||||||
let resultToken = testResult["token"] as! String
|
|
||||||
|
|
||||||
expect(userDefaultsToken).toEventually(equal(resultToken), timeout:5)
|
|
||||||
expect(testSession).toEventually(equal(client.connection.session), timeout:5)
|
|
||||||
}
|
|
||||||
|
|
||||||
it ("can add and remove a document on the server"){
|
|
||||||
var added = [NSDictionary]()
|
|
||||||
var removed = [String]()
|
|
||||||
let client = DDPClient()
|
|
||||||
let _id = client.getId()
|
|
||||||
|
|
||||||
client.events.onAdded = { collection, id, fields in if ((collection == "test-collection2") && (_id == id)) { added.append(fields!) } }
|
|
||||||
client.events.onRemoved = { collection, id in removed.append(id) }
|
|
||||||
|
|
||||||
client.connect(url) { session in
|
|
||||||
print("Connected to DDP server!!! \(session)")
|
|
||||||
client.loginWithPassword(user, password: pass) { result, e in
|
|
||||||
print("Login data: \(result), \(e)")
|
|
||||||
client.sub("test-collection2", params:nil)
|
|
||||||
client.insert("test-collection2", document: NSArray(arrayLiteral:["_id":_id, "foo":"bar"]))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// the tuple that holds the subscription data in the client should be updated to reflect that the
|
|
||||||
// subscription is ready
|
|
||||||
let subscriptionID = client.findSubscription("test-collection2")
|
|
||||||
expect(client.subscriptionReady("test-collection2")).toEventually(beTrue(), timeout:5)
|
|
||||||
|
|
||||||
// test that the data is returned from the server
|
|
||||||
expect(added.count).toEventually(equal(1), timeout:5)
|
|
||||||
expect(added[0]["foo"] as? String).toEventually(equal("bar"), timeout:5)
|
|
||||||
|
|
||||||
// test that the data is removed from the server (can also me checked on the server)
|
|
||||||
client.remove("test-collection2", document:NSArray(arrayLiteral:["_id":_id]))
|
|
||||||
expect(removed.count).toEventually(equal(1), timeout:5)
|
|
||||||
// expect(removed[0]).toEventually(equal("100"), timeout:5)
|
|
||||||
}
|
|
||||||
|
|
||||||
it ("can update a document in a collection") {
|
|
||||||
var added = [NSDictionary]()
|
|
||||||
var updated = [NSDictionary]()
|
|
||||||
let client = DDPClient()
|
|
||||||
|
|
||||||
let _id = client.getId()
|
|
||||||
|
|
||||||
client.events.onAdded = { collection, id, fields in
|
|
||||||
if ((collection == "test-collection2") && (_id == id)) {
|
|
||||||
added.append(fields!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
client.events.onChanged = { collection, id, fields, cleared in
|
|
||||||
if ((collection == "test-collection2") && (_id == id)) {
|
|
||||||
updated.append(fields!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
client.connect(url) { session in
|
|
||||||
print("Connected to DDP server!!! \(session)")
|
|
||||||
client.loginWithPassword(user, password: pass) { result, e in
|
|
||||||
print("Login data: \(result), \(e)")
|
|
||||||
client.sub("test-collection2", params:nil)
|
|
||||||
client.insert("test-collection2", document: NSArray(arrayLiteral:["_id":_id, "foo":"bar"]))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(added.count).toEventually(equal(1), timeout:10)
|
|
||||||
var params = NSMutableDictionary()
|
|
||||||
params = ["$set":["foo":"baz"]]
|
|
||||||
client.update("test-collection2", document: [["_id":_id], params]) { result, error in }
|
|
||||||
expect(updated.count).toEventually(equal(1))
|
|
||||||
client.remove("test-collection2", document: [["_id":_id]])
|
|
||||||
}
|
|
||||||
|
|
||||||
it ("can execute a method on the server that returns a value") {
|
|
||||||
var response:String!
|
|
||||||
let client = DDPClient()
|
|
||||||
|
|
||||||
client.connect(url) { session in
|
|
||||||
client.loginWithPassword(user, password: pass) { result, error in
|
|
||||||
client.method("test", params: nil) { result, error in
|
|
||||||
let r = result as! String
|
|
||||||
response = r
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(response).toEventually(equal("test123"), timeout:5)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
describe("DDP PubSub") {
|
|
||||||
|
|
||||||
// DDP Publication/Subscription
|
|
||||||
// * Requires connection to DDP Server *
|
|
||||||
|
|
||||||
// - When the client subscribes to a set of data,
|
|
||||||
// a subscription should be recorded in client.subscriptions
|
|
||||||
// - The client should receive the correct number of 'added' messages for the subscription
|
|
||||||
// - When the client receives a ready message, the ready property of the subscription tuple
|
|
||||||
// should be set to true
|
|
||||||
// - When the client unsubscribes from a set of data, the tuple describing the subscription should
|
|
||||||
// be removed from client.subscriptions
|
|
||||||
// - The client should receive the correct number of 'removed' messages for the subscription
|
|
||||||
|
|
||||||
it ("can subscribe and unsubscribe to a collection") {
|
|
||||||
var added = [String]()
|
|
||||||
var removed = [String]()
|
|
||||||
let client = DDPClient()
|
|
||||||
client.connect(url) {session in
|
|
||||||
client.loginWithPassword(user, password: pass) {result, error in
|
|
||||||
client.events.onAdded = {collection, id, fields in added.append(id) }
|
|
||||||
client.events.onRemoved = {collection, id in removed.append(id) }
|
|
||||||
client.sub("AllStates", params:nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The client should receive an ready message. When this message is received
|
|
||||||
// the added array should contain all of the data items in the subscription (in this case 3 items)
|
|
||||||
expect(client.findSubscription("AllStates")?.ready).toEventually(beTrue(), timeout:5)
|
|
||||||
expect(added.count).toEventually(equal(3), timeout:5)
|
|
||||||
|
|
||||||
client.unsub("AllStates")
|
|
||||||
|
|
||||||
// After receiving a nosub message, the subscription entry in collections should have been removed
|
|
||||||
// the removed array should contain a list of all of the items in the subscription
|
|
||||||
expect(client.findSubscription("AllStates")).toEventually(beNil(), timeout:5)
|
|
||||||
expect(removed.count).toEventually(equal(3), timeout:5)
|
|
||||||
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
// https://github.com/Quick/Quick
|
|
||||||
|
|
||||||
import Quick
|
|
||||||
import Nimble
|
|
||||||
@testable import SwiftDDP
|
|
||||||
|
|
||||||
class MeteorTest: QuickSpec {
|
|
||||||
override func spec() {
|
|
||||||
|
|
||||||
let client = Meteor.client
|
|
||||||
let collection = MeteorCollection<Document>(name: "test-collection")
|
|
||||||
|
|
||||||
describe("Document methods send notifications") {
|
|
||||||
|
|
||||||
it("sends a message when a document is added") {
|
|
||||||
|
|
||||||
try! client.ddpMessageHandler(added[0])
|
|
||||||
|
|
||||||
expect(collection.documents["2gAMzqvE8K8kBWK8F"]).toEventuallyNot(beNil())
|
|
||||||
expect(collection.documents["2gAMzqvE8K8kBWK8F"]?.city).toEventually(equal("Boston"))
|
|
||||||
}
|
|
||||||
|
|
||||||
it("sends a message when a document is removed") {
|
|
||||||
|
|
||||||
try! client.ddpMessageHandler(added[1])
|
|
||||||
expect(collection.documents["ByuwhKPGuLru8h4TT"]).toEventuallyNot(beNil())
|
|
||||||
expect(collection.documents["ByuwhKPGuLru8h4TT"]!.city).toEventually(equal("Truro"))
|
|
||||||
|
|
||||||
try! client.ddpMessageHandler(removed[1])
|
|
||||||
expect(collection.documents["ByuwhKPGuLru8h4TT"]).toEventually(beNil())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
it("sends a message when a document is updated") {
|
|
||||||
|
|
||||||
try! client.ddpMessageHandler(added[2])
|
|
||||||
expect(collection.documents["AGX6vyxCJtjqdxbFH"]).toEventuallyNot(beNil())
|
|
||||||
expect(collection.documents["AGX6vyxCJtjqdxbFH"]!.city).toEventually(equal("Austin"))
|
|
||||||
|
|
||||||
try! client.ddpMessageHandler(changed[2])
|
|
||||||
expect(collection.documents["AGX6vyxCJtjqdxbFH"]!.city).toEventually(equal("Houston"))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
BIN
assets/logo.jpg
BIN
assets/logo.jpg
Binary file not shown.
Before Width: | Height: | Size: 34 KiB |
|
@ -0,0 +1,200 @@
|
||||||
|
/* Credit to https://gist.github.com/wataru420/2048287 */
|
||||||
|
.highlight {
|
||||||
|
/* Comment */
|
||||||
|
/* Error */
|
||||||
|
/* Keyword */
|
||||||
|
/* Operator */
|
||||||
|
/* Comment.Multiline */
|
||||||
|
/* Comment.Preproc */
|
||||||
|
/* Comment.Single */
|
||||||
|
/* Comment.Special */
|
||||||
|
/* Generic.Deleted */
|
||||||
|
/* Generic.Deleted.Specific */
|
||||||
|
/* Generic.Emph */
|
||||||
|
/* Generic.Error */
|
||||||
|
/* Generic.Heading */
|
||||||
|
/* Generic.Inserted */
|
||||||
|
/* Generic.Inserted.Specific */
|
||||||
|
/* Generic.Output */
|
||||||
|
/* Generic.Prompt */
|
||||||
|
/* Generic.Strong */
|
||||||
|
/* Generic.Subheading */
|
||||||
|
/* Generic.Traceback */
|
||||||
|
/* Keyword.Constant */
|
||||||
|
/* Keyword.Declaration */
|
||||||
|
/* Keyword.Pseudo */
|
||||||
|
/* Keyword.Reserved */
|
||||||
|
/* Keyword.Type */
|
||||||
|
/* Literal.Number */
|
||||||
|
/* Literal.String */
|
||||||
|
/* Name.Attribute */
|
||||||
|
/* Name.Builtin */
|
||||||
|
/* Name.Class */
|
||||||
|
/* Name.Constant */
|
||||||
|
/* Name.Entity */
|
||||||
|
/* Name.Exception */
|
||||||
|
/* Name.Function */
|
||||||
|
/* Name.Namespace */
|
||||||
|
/* Name.Tag */
|
||||||
|
/* Name.Variable */
|
||||||
|
/* Operator.Word */
|
||||||
|
/* Text.Whitespace */
|
||||||
|
/* Literal.Number.Float */
|
||||||
|
/* Literal.Number.Hex */
|
||||||
|
/* Literal.Number.Integer */
|
||||||
|
/* Literal.Number.Oct */
|
||||||
|
/* Literal.String.Backtick */
|
||||||
|
/* Literal.String.Char */
|
||||||
|
/* Literal.String.Doc */
|
||||||
|
/* Literal.String.Double */
|
||||||
|
/* Literal.String.Escape */
|
||||||
|
/* Literal.String.Heredoc */
|
||||||
|
/* Literal.String.Interpol */
|
||||||
|
/* Literal.String.Other */
|
||||||
|
/* Literal.String.Regex */
|
||||||
|
/* Literal.String.Single */
|
||||||
|
/* Literal.String.Symbol */
|
||||||
|
/* Name.Builtin.Pseudo */
|
||||||
|
/* Name.Variable.Class */
|
||||||
|
/* Name.Variable.Global */
|
||||||
|
/* Name.Variable.Instance */
|
||||||
|
/* Literal.Number.Integer.Long */ }
|
||||||
|
.highlight .c {
|
||||||
|
color: #999988;
|
||||||
|
font-style: italic; }
|
||||||
|
.highlight .err {
|
||||||
|
color: #a61717;
|
||||||
|
background-color: #e3d2d2; }
|
||||||
|
.highlight .k {
|
||||||
|
color: #000000;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .o {
|
||||||
|
color: #000000;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .cm {
|
||||||
|
color: #999988;
|
||||||
|
font-style: italic; }
|
||||||
|
.highlight .cp {
|
||||||
|
color: #999999;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .c1 {
|
||||||
|
color: #999988;
|
||||||
|
font-style: italic; }
|
||||||
|
.highlight .cs {
|
||||||
|
color: #999999;
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: italic; }
|
||||||
|
.highlight .gd {
|
||||||
|
color: #000000;
|
||||||
|
background-color: #ffdddd; }
|
||||||
|
.highlight .gd .x {
|
||||||
|
color: #000000;
|
||||||
|
background-color: #ffaaaa; }
|
||||||
|
.highlight .ge {
|
||||||
|
color: #000000;
|
||||||
|
font-style: italic; }
|
||||||
|
.highlight .gr {
|
||||||
|
color: #aa0000; }
|
||||||
|
.highlight .gh {
|
||||||
|
color: #999999; }
|
||||||
|
.highlight .gi {
|
||||||
|
color: #000000;
|
||||||
|
background-color: #ddffdd; }
|
||||||
|
.highlight .gi .x {
|
||||||
|
color: #000000;
|
||||||
|
background-color: #aaffaa; }
|
||||||
|
.highlight .go {
|
||||||
|
color: #888888; }
|
||||||
|
.highlight .gp {
|
||||||
|
color: #555555; }
|
||||||
|
.highlight .gs {
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .gu {
|
||||||
|
color: #aaaaaa; }
|
||||||
|
.highlight .gt {
|
||||||
|
color: #aa0000; }
|
||||||
|
.highlight .kc {
|
||||||
|
color: #000000;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .kd {
|
||||||
|
color: #000000;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .kp {
|
||||||
|
color: #000000;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .kr {
|
||||||
|
color: #000000;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .kt {
|
||||||
|
color: #445588; }
|
||||||
|
.highlight .m {
|
||||||
|
color: #009999; }
|
||||||
|
.highlight .s {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .na {
|
||||||
|
color: #008080; }
|
||||||
|
.highlight .nb {
|
||||||
|
color: #0086B3; }
|
||||||
|
.highlight .nc {
|
||||||
|
color: #445588;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .no {
|
||||||
|
color: #008080; }
|
||||||
|
.highlight .ni {
|
||||||
|
color: #800080; }
|
||||||
|
.highlight .ne {
|
||||||
|
color: #990000;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .nf {
|
||||||
|
color: #990000; }
|
||||||
|
.highlight .nn {
|
||||||
|
color: #555555; }
|
||||||
|
.highlight .nt {
|
||||||
|
color: #000080; }
|
||||||
|
.highlight .nv {
|
||||||
|
color: #008080; }
|
||||||
|
.highlight .ow {
|
||||||
|
color: #000000;
|
||||||
|
font-weight: bold; }
|
||||||
|
.highlight .w {
|
||||||
|
color: #bbbbbb; }
|
||||||
|
.highlight .mf {
|
||||||
|
color: #009999; }
|
||||||
|
.highlight .mh {
|
||||||
|
color: #009999; }
|
||||||
|
.highlight .mi {
|
||||||
|
color: #009999; }
|
||||||
|
.highlight .mo {
|
||||||
|
color: #009999; }
|
||||||
|
.highlight .sb {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .sc {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .sd {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .s2 {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .se {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .sh {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .si {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .sx {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .sr {
|
||||||
|
color: #009926; }
|
||||||
|
.highlight .s1 {
|
||||||
|
color: #d14; }
|
||||||
|
.highlight .ss {
|
||||||
|
color: #990073; }
|
||||||
|
.highlight .bp {
|
||||||
|
color: #999999; }
|
||||||
|
.highlight .vc {
|
||||||
|
color: #008080; }
|
||||||
|
.highlight .vg {
|
||||||
|
color: #008080; }
|
||||||
|
.highlight .vi {
|
||||||
|
color: #008080; }
|
||||||
|
.highlight .il {
|
||||||
|
color: #009999; }
|
|
@ -0,0 +1,331 @@
|
||||||
|
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
|
||||||
|
background: transparent;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
outline: 0;
|
||||||
|
padding: 0;
|
||||||
|
vertical-align: baseline; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
font-family: Helvetica, freesans, Arial, sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
-webkit-font-smoothing: subpixel-antialiased;
|
||||||
|
word-wrap: break-word; }
|
||||||
|
|
||||||
|
h1, h2, h3 {
|
||||||
|
margin-top: 0.8em;
|
||||||
|
margin-bottom: 0.3em;
|
||||||
|
font-weight: 100;
|
||||||
|
color: black; }
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2.5em; }
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 2em;
|
||||||
|
border-bottom: 1px solid #e2e2e2; }
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.5;
|
||||||
|
margin-top: 21px; }
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-size: 1.1em; }
|
||||||
|
|
||||||
|
h6 {
|
||||||
|
font-size: 1.1em;
|
||||||
|
color: #777; }
|
||||||
|
|
||||||
|
.section-name {
|
||||||
|
color: gray;
|
||||||
|
display: block;
|
||||||
|
font-family: Helvetica;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 100;
|
||||||
|
margin-bottom: 15px; }
|
||||||
|
|
||||||
|
pre, code {
|
||||||
|
font: 0.95em Menlo, monospace;
|
||||||
|
color: #777;
|
||||||
|
word-wrap: normal; }
|
||||||
|
|
||||||
|
p code, li code {
|
||||||
|
background-color: #eee;
|
||||||
|
padding: 2px 4px;
|
||||||
|
border-radius: 4px; }
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #0088cc;
|
||||||
|
text-decoration: none; }
|
||||||
|
|
||||||
|
ul {
|
||||||
|
padding-left: 15px; }
|
||||||
|
|
||||||
|
li {
|
||||||
|
line-height: 1.8em; }
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%; }
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
margin-left: 0;
|
||||||
|
padding: 0 10px;
|
||||||
|
border-left: 4px solid #ccc; }
|
||||||
|
|
||||||
|
.content-wrapper {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 980px; }
|
||||||
|
|
||||||
|
header {
|
||||||
|
font-size: 0.85em;
|
||||||
|
line-height: 26px;
|
||||||
|
background-color: #414141;
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 1; }
|
||||||
|
header img {
|
||||||
|
padding-right: 6px;
|
||||||
|
vertical-align: -4px;
|
||||||
|
height: 16px; }
|
||||||
|
header a {
|
||||||
|
color: #fff; }
|
||||||
|
header p {
|
||||||
|
float: left;
|
||||||
|
color: #999; }
|
||||||
|
header .header-right {
|
||||||
|
float: right;
|
||||||
|
margin-left: 16px; }
|
||||||
|
|
||||||
|
#breadcrumbs {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
height: 27px;
|
||||||
|
padding-top: 17px;
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 1;
|
||||||
|
margin-top: 26px; }
|
||||||
|
#breadcrumbs #carat {
|
||||||
|
height: 10px;
|
||||||
|
margin: 0 5px; }
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
position: fixed;
|
||||||
|
top: 70px;
|
||||||
|
bottom: 0;
|
||||||
|
width: 230px;
|
||||||
|
word-wrap: normal; }
|
||||||
|
|
||||||
|
.nav-groups {
|
||||||
|
list-style-type: none;
|
||||||
|
background: #fff;
|
||||||
|
padding-left: 0; }
|
||||||
|
|
||||||
|
.nav-group-name {
|
||||||
|
border-bottom: 1px solid #e2e2e2;
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-weight: 100;
|
||||||
|
padding: 15px 0 15px 20px; }
|
||||||
|
.nav-group-name > a {
|
||||||
|
color: #333; }
|
||||||
|
|
||||||
|
.nav-group-tasks {
|
||||||
|
margin-top: 5px; }
|
||||||
|
|
||||||
|
.nav-group-task {
|
||||||
|
font-size: 0.9em;
|
||||||
|
list-style-type: none; }
|
||||||
|
.nav-group-task a {
|
||||||
|
color: #888; }
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
margin-left: 246px;
|
||||||
|
position: absolute;
|
||||||
|
overflow: hidden;
|
||||||
|
padding-bottom: 60px;
|
||||||
|
top: 70px;
|
||||||
|
width: 734px; }
|
||||||
|
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
|
||||||
|
margin-bottom: 1em; }
|
||||||
|
.main-content p {
|
||||||
|
line-height: 1.8em; }
|
||||||
|
.main-content section .section:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
padding-top: 0; }
|
||||||
|
.main-content section .task-group-section .task-group:first-of-type {
|
||||||
|
padding-top: 10px; }
|
||||||
|
.main-content section .task-group-section .task-group:first-of-type .section-name {
|
||||||
|
padding-top: 15px; }
|
||||||
|
|
||||||
|
.section {
|
||||||
|
padding: 0 25px; }
|
||||||
|
|
||||||
|
.highlight {
|
||||||
|
background-color: #eee;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow-x: auto; }
|
||||||
|
|
||||||
|
.declaration .highlight {
|
||||||
|
overflow-x: initial;
|
||||||
|
padding: 0 40px 40px 0;
|
||||||
|
margin-bottom: -25px;
|
||||||
|
background-color: transparent;
|
||||||
|
border: none; }
|
||||||
|
|
||||||
|
.section-name {
|
||||||
|
margin: 0;
|
||||||
|
margin-left: 18px; }
|
||||||
|
|
||||||
|
.task-group-section {
|
||||||
|
padding-left: 6px;
|
||||||
|
border-top: 1px solid #e2e2e2; }
|
||||||
|
|
||||||
|
.task-group {
|
||||||
|
padding-top: 0px; }
|
||||||
|
|
||||||
|
.task-name-container a[name]:before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
padding-top: 70px;
|
||||||
|
margin: -70px 0 0; }
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding-top: 8px;
|
||||||
|
width: 100%;
|
||||||
|
list-style-type: none; }
|
||||||
|
.item a[name]:before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
padding-top: 70px;
|
||||||
|
margin: -70px 0 0; }
|
||||||
|
.item code {
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 0; }
|
||||||
|
.item .token {
|
||||||
|
padding-left: 3px;
|
||||||
|
margin-left: 15px;
|
||||||
|
font-size: 11.9px; }
|
||||||
|
.item .declaration-note {
|
||||||
|
font-size: .85em;
|
||||||
|
color: gray;
|
||||||
|
font-style: italic; }
|
||||||
|
|
||||||
|
.pointer-container {
|
||||||
|
border-bottom: 1px solid #e2e2e2;
|
||||||
|
left: -23px;
|
||||||
|
padding-bottom: 13px;
|
||||||
|
position: relative;
|
||||||
|
width: 110%; }
|
||||||
|
|
||||||
|
.pointer {
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-left: 1px solid #e2e2e2;
|
||||||
|
border-top: 1px solid #e2e2e2;
|
||||||
|
height: 12px;
|
||||||
|
left: 21px;
|
||||||
|
top: -7px;
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
-moz-transform: rotate(45deg);
|
||||||
|
-o-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
position: absolute;
|
||||||
|
width: 12px; }
|
||||||
|
|
||||||
|
.height-container {
|
||||||
|
display: none;
|
||||||
|
left: -25px;
|
||||||
|
padding: 0 25px;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden; }
|
||||||
|
.height-container .section {
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-bottom: 1px solid #e2e2e2;
|
||||||
|
left: -25px;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 5px; }
|
||||||
|
|
||||||
|
.aside, .language {
|
||||||
|
padding: 6px 12px;
|
||||||
|
margin: 12px 0;
|
||||||
|
border-left: 5px solid #dddddd;
|
||||||
|
overflow-y: hidden; }
|
||||||
|
.aside .aside-title, .language .aside-title {
|
||||||
|
font-size: 9px;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding-bottom: 0;
|
||||||
|
margin: 0;
|
||||||
|
color: #aaa;
|
||||||
|
-webkit-user-select: none; }
|
||||||
|
.aside p:last-child, .language p:last-child {
|
||||||
|
margin-bottom: 0; }
|
||||||
|
|
||||||
|
.language {
|
||||||
|
border-left: 5px solid #cde9f4; }
|
||||||
|
.language .aside-title {
|
||||||
|
color: #4b8afb; }
|
||||||
|
|
||||||
|
.aside-warning {
|
||||||
|
border-left: 5px solid #ff6666; }
|
||||||
|
.aside-warning .aside-title {
|
||||||
|
color: #ff0000; }
|
||||||
|
|
||||||
|
.graybox {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%; }
|
||||||
|
.graybox p {
|
||||||
|
margin: 0;
|
||||||
|
word-break: break-word;
|
||||||
|
min-width: 50px; }
|
||||||
|
.graybox td {
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
padding: 5px 25px 5px 10px;
|
||||||
|
vertical-align: middle; }
|
||||||
|
.graybox tr td:first-of-type {
|
||||||
|
text-align: right;
|
||||||
|
padding: 7px;
|
||||||
|
vertical-align: top;
|
||||||
|
word-break: normal;
|
||||||
|
width: 40px; }
|
||||||
|
|
||||||
|
.slightly-smaller {
|
||||||
|
font-size: 0.9em; }
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
margin-left: 25px; }
|
||||||
|
#footer p {
|
||||||
|
margin: 0;
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 0.8em; }
|
||||||
|
|
||||||
|
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
|
||||||
|
display: none; }
|
||||||
|
html.dash .main-content {
|
||||||
|
width: 980px;
|
||||||
|
margin-left: 0;
|
||||||
|
border: none;
|
||||||
|
width: 100%;
|
||||||
|
top: 0;
|
||||||
|
padding-bottom: 0; }
|
||||||
|
html.dash .height-container {
|
||||||
|
display: block; }
|
||||||
|
html.dash .item .token {
|
||||||
|
margin-left: 0; }
|
||||||
|
html.dash .content-wrapper {
|
||||||
|
width: auto; }
|
||||||
|
html.dash #footer {
|
||||||
|
position: static; }
|
Binary file not shown.
After Width: | Height: | Size: 274 B |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,432 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>SwiftDDP Reference</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<script src="js/jquery.min.js" defer></script>
|
||||||
|
<script src="js/jazzy.js" defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a title="SwiftDDP Reference"></a>
|
||||||
|
<header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p><a href="index.html">SwiftDDP Docs</a> (69% documented)</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<p id="breadcrumbs">
|
||||||
|
<a href="index.html">SwiftDDP Reference</a>
|
||||||
|
<img id="carat" src="img/carat.png" />
|
||||||
|
SwiftDDP Reference
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<nav class="sidebar">
|
||||||
|
<ul class="nav-groups">
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Classes.html">Classes</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/AbstractCollection.html">AbstractCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/DDPClient.html">DDPClient</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/EJSON.html">EJSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/Meteor.html">Meteor</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorCollection.html">MeteorCollection</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorDocument.html">MeteorDocument</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes.html#/s:C8SwiftDDP11MeteorOAuth">MeteorOAuth</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthDialogViewController.html">MeteorOAuthDialogViewController</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Classes/MeteorOAuthServices.html">MeteorOAuthServices</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Global Variables.html">Global Variables</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP18DDP_USER_DID_LOGINSS">DDP_USER_DID_LOGIN</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP19DDP_USER_DID_LOGOUTSS">DDP_USER_DID_LOGOUT</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Global Variables.html#/s:v8SwiftDDP32METEOR_COLLECTION_SET_DID_CHANGESS">METEOR_COLLECTION_SET_DID_CHANGE</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Enums.html">Enums</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Enums/DDPMessageType.html">DDPMessageType</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Protocols.html">Protocols</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/MeteorCollectionType.html">MeteorCollectionType</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Protocols/SwiftDDPDelegate.html">SwiftDDPDelegate</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-name">
|
||||||
|
<a href="Structs.html">Structs</a>
|
||||||
|
<ul class="nav-group-tasks">
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs.html#/s:V8SwiftDDP10Completion">Completion</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPError.html">DDPError</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPEvents.html">DDPEvents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/DDPMessage.html">DDPMessage</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-group-task">
|
||||||
|
<a href="Structs/Result.html">Result</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<article class="main-content">
|
||||||
|
<section>
|
||||||
|
<section class="section">
|
||||||
|
|
||||||
|
<a href='#swiftddp' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='swiftddp'>SwiftDDP</h1>
|
||||||
|
<a href='#a_client_for_meteor_servers_written_in_swift' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='a_client_for_meteor_servers_written_in_swift'>A client for Meteor servers, written in Swift</h2>
|
||||||
|
<a href='#license' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='license'>License</h4>
|
||||||
|
|
||||||
|
<p>MIT </p>
|
||||||
|
|
||||||
|
<p><a href="http://cocoapods.org/pods/SwiftDDP"><img src="https://img.shields.io/cocoapods/v/SwiftDDP.svg?style=flat" alt="Version"></a>
|
||||||
|
<a href="http://cocoapods.org/pods/SwiftDDP"><img src="https://img.shields.io/cocoapods/l/SwiftDDP.svg?style=flat" alt="License"></a>
|
||||||
|
<a href="http://cocoapods.org/pods/SwiftDDP"><img src="https://img.shields.io/cocoapods/p/SwiftDDP.svg?style=flat" alt="Platform"></a></p>
|
||||||
|
<a href='#changelog' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='changelog'>Changelog</h2>
|
||||||
|
<a href='#0_3_0' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='0_3_0'>0.3.0:</h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Changed default subscription behavior</li>
|
||||||
|
<li>Added a method to sign a user in via username</li>
|
||||||
|
</ul>
|
||||||
|
<a href='#version_0_3_0_contains_breaking_changes' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h5 id='version_0_3_0_contains_breaking_changes'>Version 0.3.0 contains breaking changes</h5>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>You can now update a subscription by changing its parameters without first unsubscribing. This will subscribe the client to any documents associated with the new subscription and parameters. When you pass a new set of parameters to a subscription that you have previously subscribed to, you remain subscribed to any documents associated with that prior subscription.<br></li>
|
||||||
|
<li>The subscription method returns an id. To unsubscribe to documents associated with a specific set of parameters, you must unsubscribe with this id.</li>
|
||||||
|
<li>Unsubscribing by name now works differently. When unsubscribing by name, you unsubscribe to any and all subscriptions with that name.</li>
|
||||||
|
<li>You can no longer pass a callback to <code>unsubscribe(name:String)</code>. It now returns an array with the ids of the subscriptions you’ve unsubscribed to.</li>
|
||||||
|
</ul>
|
||||||
|
<a href='#0_2_2_1' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='0_2_2_1'>0.2.2.1:</h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Improved subscription handling across app states</li>
|
||||||
|
<li>Dependencies updated for Swift 2.2</li>
|
||||||
|
</ul>
|
||||||
|
<a href='#0_2_1' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='0_2_1'>0.2.1:</h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Reconnection behavior improvements: reconnect attempts now follow an exponential backoff pattern</li>
|
||||||
|
<li>Client now connects to servers using self signed SSL certificates when allowSelfSignedSSL is set to true</li>
|
||||||
|
<li>The loglevel can now be set directly using the logLevel property on the client. The default setting is .None</li>
|
||||||
|
</ul>
|
||||||
|
<a href='#0_2_0' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='0_2_0'>0.2.0:</h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Integration with Meteor’s Facebook, Twitter & other login services</li>
|
||||||
|
</ul>
|
||||||
|
<a href='#installation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='installation'>Installation</h2>
|
||||||
|
|
||||||
|
<p>With <a href="http://cocoapods.org">CocoaPods</a>. Add the following line to your Podfile:</p>
|
||||||
|
<pre class="highlight ruby"><code><span class="n">pod</span> <span class="s2">"SwiftDDP"</span><span class="p">,</span> <span class="s2">"~> 0.3.0"</span>
|
||||||
|
</code></pre>
|
||||||
|
<a href='#documentation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='documentation'>Documentation</h2>
|
||||||
|
<a href='#a_href_https_siegesmund_github_io_swiftddp_api_reference_a' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='a_href_https_siegesmund_github_io_swiftddp_api_reference_a'><a href="https://siegesmund.github.io/SwiftDDP">API Reference</a></h3>
|
||||||
|
<a href='#quick_start' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='quick_start'>Quick Start</h3>
|
||||||
|
<a href='#setting_basic_configuration_options' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='setting_basic_configuration_options'>Setting basic configuration options</h4>
|
||||||
|
<pre class="highlight swift"><code><span class="kd">import</span> <span class="kt">SwiftDDP</span>
|
||||||
|
|
||||||
|
<span class="kt">Meteor</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">allowSelfSignedSSL</span> <span class="o">=</span> <span class="kc">true</span> <span class="c1">// Connect to a server that uses a self signed ssl certificate</span>
|
||||||
|
<span class="kt">Meteor</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="kt">Info</span> <span class="c1">// Options are: .Verbose, .Debug, .Info, .Warning, .Error, .Severe, .None</span>
|
||||||
|
</code></pre>
|
||||||
|
<a href='#connecting_to_a_meteor_server' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='connecting_to_a_meteor_server'>Connecting to a Meteor server</h4>
|
||||||
|
<pre class="highlight swift"><code>
|
||||||
|
<span class="c1">// Meteor.connect will automatically connect and will sign in using</span>
|
||||||
|
<span class="c1">// a stored login token if the client was previously signed in.</span>
|
||||||
|
|
||||||
|
<span class="kt">Meteor</span><span class="o">.</span><span class="nf">connect</span><span class="p">(</span><span class="s">"wss://todos.meteor.com/websocket"</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// do something after the client connects</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</code></pre>
|
||||||
|
<a href='#login_amp_logout_with_facebook_twitter_etc_beta' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='login_amp_logout_with_facebook_twitter_etc_beta'>Login & Logout with Facebook, Twitter, etc. (beta)</h4>
|
||||||
|
|
||||||
|
<p>These services use the standard Meteor accounts packages. Just add the appropriate package on the server (e.g. <code>meteor add accounts-facebook</code>) and follow the web-based provider setup. Choose redirect, rather than popup and save your appId/clientId as you’ll need it again in your iOS application.</p>
|
||||||
|
|
||||||
|
<p>In your iOS app, create a UIButton and associate its’ action with the appropriate Meteor login method. That’s it!
|
||||||
|
“`swift
|
||||||
|
class ViewController: UIViewController {</p>
|
||||||
|
<pre class="highlight plaintext"><code>// client id is the id that Facebook, Google etc. assigns your app.
|
||||||
|
let GITHUB_CLIENT_ID = "1234567890"
|
||||||
|
let FACEBOOK_CLIENT_ID = "qwertyuiop"
|
||||||
|
let GOOGLE_CLIENT_ID = "asdfghjkl"
|
||||||
|
|
||||||
|
// Note that Twitter does not require a client id
|
||||||
|
@IBAction func loginWithTwitterWasClicked(sender: UIButton) {
|
||||||
|
Meteor.loginWithTwitter(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func loginWithFacebookWasClicked(sender: UIButton) {
|
||||||
|
Meteor.loginWithFacebook(FACEBOOK_CLIENT_ID, viewController: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func loginWithGoogleWasClicked(sender: UIButton) {
|
||||||
|
Meteor.loginWithGoogle(GOOGLE_CLIENT_ID, viewController: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func loginWithGithubWasClicked(sender: UIButton) {
|
||||||
|
Meteor.loginWithGithub(GITHUB_CLIENT_ID, viewController: self)
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>}</p>
|
||||||
|
<pre class="highlight plaintext"><code>#### Gotchas and implementation notes for OAuth login flows
|
||||||
|
When configuring OAuth services
|
||||||
|
* If you connect over wss (as you should), then you must provide a https:// app url and redirect url to the service provider. If you connect over ws, you must use http:// for your app url and redirect url. In other words, you can't mix the two.
|
||||||
|
* You'll need to choose redirect rather than popup in the Meteor OAuth configuration dialog
|
||||||
|
* Once configured, Meteor provides the appId/clientId via the "meteor.loginServiceConfiguration" publication, which SwiftDDP automatically subscribes to. However, SwiftDDP currently requires that you explicitly provide the appId as this allows the user to begin logging in immediately, rather than waiting for the initial batch of subscriptions to finish.
|
||||||
|
|
||||||
|
#### Login & Logout with password
|
||||||
|
|
||||||
|
Login using email and password.
|
||||||
|
|
||||||
|
```swift
|
||||||
|
Meteor.loginWithPassword("user@swiftddp.com", password: "********") { result, error in
|
||||||
|
// do something after login
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Login using username and password.</p>
|
||||||
|
<pre class="highlight swift"><code><span class="kt">Meteor</span><span class="o">.</span><span class="nf">loginWithUsername</span><span class="p">(</span><span class="s">"swiftddp"</span><span class="p">,</span> <span class="nv">password</span><span class="p">:</span> <span class="s">"********"</span><span class="p">)</span> <span class="p">{</span> <span class="n">result</span><span class="p">,</span> <span class="n">error</span> <span class="k">in</span>
|
||||||
|
<span class="c1">// do something after login</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Log out.</p>
|
||||||
|
<pre class="highlight swift"><code><span class="kt">Meteor</span><span class="o">.</span><span class="nf">logout</span><span class="p">()</span> <span class="p">{</span> <span class="n">result</span><span class="p">,</span> <span class="n">error</span> <span class="k">in</span>
|
||||||
|
<span class="c1">// do something after logout</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>The client also posts a notification when the user signs in and signs out.</p>
|
||||||
|
<pre class="highlight swift"><code><span class="c1">// Notification name (a string global variable)</span>
|
||||||
|
<span class="kt">DDP_USER_DID_LOGIN</span>
|
||||||
|
<span class="kt">DDP_USER_DID_LOGOUT</span>
|
||||||
|
|
||||||
|
<span class="c1">// Example</span>
|
||||||
|
<span class="kt">NSNotificationCenter</span><span class="o">.</span><span class="nf">defaultCenter</span><span class="p">()</span><span class="o">.</span><span class="nf">addObserver</span><span class="p">(</span><span class="k">self</span><span class="p">,</span> <span class="nv">selector</span><span class="p">:</span> <span class="s">"userDidLogin"</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">DDP_USER_DID_LOGIN</span><span class="p">,</span> <span class="nv">object</span><span class="p">:</span> <span class="kc">nil</span><span class="p">)</span>
|
||||||
|
<span class="kt">NSNotificationCenter</span><span class="o">.</span><span class="nf">defaultCenter</span><span class="p">()</span><span class="o">.</span><span class="nf">addObserver</span><span class="p">(</span><span class="k">self</span><span class="p">,</span> <span class="nv">selector</span><span class="p">:</span> <span class="s">"userDidLogout"</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">DDP_USER_DID_LOGOUT</span><span class="p">,</span> <span class="nv">object</span><span class="p">:</span> <span class="kc">nil</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<span class="kd">func</span> <span class="nf">userDidLogin</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="nf">print</span><span class="p">(</span><span class="s">"The user just signed in!"</span><span class="p">)</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="kd">func</span> <span class="nf">userDidLogout</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="nf">print</span><span class="p">(</span><span class="s">"The user just signed out!"</span><span class="p">)</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</code></pre>
|
||||||
|
<a href='#subscribe_to_a_subset_of_a_collection_on_the_server' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='subscribe_to_a_subset_of_a_collection_on_the_server'>Subscribe to a subset of a collection on the server</h4>
|
||||||
|
<pre class="highlight swift"><code><span class="kt">Meteor</span><span class="o">.</span><span class="nf">subscribe</span><span class="p">(</span><span class="s">"todos"</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<span class="kt">Meteor</span><span class="o">.</span><span class="nf">subscribe</span><span class="p">(</span><span class="s">"todos"</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Do something when the todos subscription is ready</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="kt">Meteor</span><span class="o">.</span><span class="nf">subscribe</span><span class="p">(</span><span class="s">"todos"</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">])</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Do something when the todos subscription is ready</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</code></pre>
|
||||||
|
<a href='#call_a_method_on_the_server' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='call_a_method_on_the_server'>Call a method on the server</h4>
|
||||||
|
<pre class="highlight swift"><code><span class="kt">Meteor</span><span class="o">.</span><span class="nf">call</span><span class="p">(</span><span class="s">"foo"</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">])</span> <span class="p">{</span> <span class="n">result</span><span class="p">,</span> <span class="n">error</span> <span class="k">in</span>
|
||||||
|
<span class="c1">// Do something with the method result</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>When passing parameters to a server method, the parameters object must be serializable with NSJSONSerialization</p>
|
||||||
|
<a href='#simple_in_memory_persistence' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='simple_in_memory_persistence'>Simple in-memory persistence</h4>
|
||||||
|
|
||||||
|
<p>SwiftDDP includes a class called MeteorCollection that provides simple, ephemeral dictionary backed persistence. MeteorCollection stores objects subclassed from MeteorDocument. Creating a collection is as simple as:</p>
|
||||||
|
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">List</span><span class="p">:</span> <span class="kt">MeteorDocument</span> <span class="p">{</span>
|
||||||
|
|
||||||
|
<span class="k">var</span> <span class="nv">collection</span><span class="p">:</span><span class="kt">String</span> <span class="o">=</span> <span class="s">"lists"</span>
|
||||||
|
<span class="k">var</span> <span class="nv">name</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span>
|
||||||
|
<span class="k">var</span> <span class="nv">userId</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span>
|
||||||
|
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="k">let</span> <span class="nv">lists</span> <span class="o">=</span> <span class="kt">MeteorCollection</span><span class="o"><</span><span class="kt">List</span><span class="o">></span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"lists"</span><span class="p">)</span> <span class="c1">// As with Meteorjs, the name is the name of the server-side collection </span>
|
||||||
|
<span class="kt">Meteor</span><span class="o">.</span><span class="nf">subscribe</span><span class="p">(</span><span class="s">"lists"</span><span class="p">)</span>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>For client side insertions, updates and removals:</p>
|
||||||
|
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">list</span> <span class="o">=</span> <span class="kt">List</span><span class="p">(</span><span class="nv">id</span><span class="p">:</span> <span class="kt">Meteor</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="nf">getId</span><span class="p">(),</span> <span class="nv">fields</span><span class="p">:</span> <span class="p">[</span><span class="s">"name"</span><span class="p">:</span> <span class="s">"foo"</span><span class="p">])</span>
|
||||||
|
|
||||||
|
<span class="c1">// Insert the object on both the client and server.</span>
|
||||||
|
<span class="n">lists</span><span class="o">.</span><span class="nf">insert</span><span class="p">(</span><span class="n">list</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<span class="c1">// Update the object on both the client and server</span>
|
||||||
|
<span class="n">list</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">"bar"</span>
|
||||||
|
<span class="n">lists</span><span class="o">.</span><span class="nf">update</span><span class="p">(</span><span class="n">list</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<span class="c1">// Remove the object on both the client and server</span>
|
||||||
|
<span class="n">lists</span><span class="o">.</span><span class="nf">remove</span><span class="p">(</span><span class="n">list</span><span class="p">)</span>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>For each operation the action is executed on the client, and rolled back if the server returns an error.</p>
|
||||||
|
<a href='#example_projects' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='example_projects'>Example Projects</h2>
|
||||||
|
<a href='#todos' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='todos'>Todos</h4>
|
||||||
|
|
||||||
|
<p>These are iOS implementations of <a href="https://www.meteor.com/todos">Meteor’s Todos example</a>. The best way to run the examples is to connect to a local instance of Meteor’s Todos app: <code>meteor create --example todos && cd todos && meteor</code>. You can specify the server that the Todos app connects to by changing the url variable in AppDelegate.swift. There are currently two flavors: a simple example with dictionary based persistence and an example showing how to use SwiftDDP with Core Data and NSFetchedResultsController.
|
||||||
|
- <a href="https://github.com/siegesmund/SwiftDDP/tree/master/Examples/Dictionary">Meteor Todos with dictionary based in-memory storage</a>
|
||||||
|
- <a href="https://github.com/siegesmund/SwiftDDP/tree/master/Examples/CoreData">Meteor Todos Core Data integration</a></p>
|
||||||
|
|
||||||
|
<p>When running the examples with preexisting instances of the todos app hosted at *.meteor.com, note that connectivity to apps hosted on Meteor’s free hosting (not to be confused with Galaxy) can be erratic as the server periodically idles. If SwiftTodos does not connect or you cannot add or remove items or login, try connecting to a different instance. The surest way to do this is to run an instance of the todos app locally.</p>
|
||||||
|
|
||||||
|
<p><code>bash meteor create --example todos</code></p>
|
||||||
|
|
||||||
|
<p>Once you’ve created and started the Meteor todos server, set the url variable in AppDelegate.swift to ws://localhost:3000/websocket, then run the iOS app.</p>
|
||||||
|
<a href='#example_creating_an_array_based_custom_collection' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='example_creating_an_array_based_custom_collection'>Example: Creating an array based custom collection</h2>
|
||||||
|
<a href='#the_following_pattern_can_be_used_to_create_custom_collections_backed_by_any_datastore' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='the_following_pattern_can_be_used_to_create_custom_collections_backed_by_any_datastore'>The following pattern can be used to create custom collections backed by any datastore</h4>
|
||||||
|
|
||||||
|
<p>In this example, we’ll create a simple collection to hold a list of contacts. The first thing we’ll do is create an object to represent a contact. This object has four properties and a method named <em>update</em> that maps the <em>fields</em> NSDictionary to the struct’s properties. <em>Update</em> is called when an object is created and when an update is performed. Meteor will always transmit an <strong>id</strong> to identify the object that should be added, updated or removed, so objects that represent Meteor documents must <strong>always</strong> have an id field. Here we’re sticking to the MongoDB convention of naming our id <em>_id</em>.</p>
|
||||||
|
<pre class="highlight swift"><code>
|
||||||
|
<span class="kd">struct</span> <span class="kt">Contact</span> <span class="p">{</span>
|
||||||
|
|
||||||
|
<span class="k">var</span> <span class="nv">_id</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span>
|
||||||
|
<span class="k">var</span> <span class="nv">name</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span>
|
||||||
|
<span class="k">var</span> <span class="nv">phone</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span>
|
||||||
|
<span class="k">var</span> <span class="nv">email</span><span class="p">:</span><span class="kt">String</span><span class="p">?</span>
|
||||||
|
|
||||||
|
<span class="nf">init</span><span class="p">(</span><span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?)</span> <span class="p">{</span>
|
||||||
|
<span class="k">self</span><span class="o">.</span><span class="n">_id</span> <span class="o">=</span> <span class="n">id</span>
|
||||||
|
<span class="nf">update</span><span class="p">(</span><span class="n">fields</span><span class="p">)</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="k">mutating</span> <span class="kd">func</span> <span class="nf">update</span><span class="p">(</span><span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?)</span> <span class="p">{</span>
|
||||||
|
|
||||||
|
<span class="k">if</span> <span class="k">let</span> <span class="nv">name</span> <span class="o">=</span> <span class="n">fields</span><span class="p">?</span><span class="o">.</span><span class="nf">valueForKey</span><span class="p">(</span><span class="s">"name"</span><span class="p">)</span> <span class="k">as?</span> <span class="kt">String</span> <span class="p">{</span>
|
||||||
|
<span class="k">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="k">if</span> <span class="k">let</span> <span class="nv">phone</span> <span class="o">=</span> <span class="n">fields</span><span class="p">?</span><span class="o">.</span><span class="nf">valueForKey</span><span class="p">(</span><span class="s">"phone"</span><span class="p">)</span> <span class="k">as?</span> <span class="kt">String</span> <span class="p">{</span>
|
||||||
|
<span class="k">self</span><span class="o">.</span><span class="n">phone</span> <span class="o">=</span> <span class="n">phone</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="k">if</span> <span class="k">let</span> <span class="nv">email</span> <span class="o">=</span> <span class="n">fields</span><span class="p">?</span><span class="o">.</span><span class="nf">valueForKey</span><span class="p">(</span><span class="s">"email"</span><span class="p">)</span> <span class="k">as?</span> <span class="kt">String</span> <span class="p">{</span>
|
||||||
|
<span class="k">self</span><span class="o">.</span><span class="n">email</span> <span class="o">=</span> <span class="n">email</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Next, we’ll create the collection class that will hold our contacts and provide the logic to respond to server-side changes to the documents and the subscription set. SwiftDDP contains an abstract class called AbstractCollection that can be used to build custom collections. Subclassing AbstractCollection allows you to override three methods that are called in response to events on the server: <em>documentWasAdded</em>, <em>documentWasChanged</em> and <em>documentWasRemoved</em>.</p>
|
||||||
|
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">UserCollection</span><span class="p">:</span> <span class="kt">AbstractCollection</span> <span class="p">{</span>
|
||||||
|
|
||||||
|
<span class="k">var</span> <span class="nv">contacts</span> <span class="o">=</span> <span class="p">[</span><span class="kt">Contact</span><span class="p">]()</span>
|
||||||
|
|
||||||
|
<span class="c1">// Include any logic that needs to occur when a document is added to the collection on the server</span>
|
||||||
|
<span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">documentWasAdded</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?)</span> <span class="p">{</span>
|
||||||
|
<span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="n">id</span><span class="p">,</span> <span class="n">fields</span><span class="p">)</span>
|
||||||
|
<span class="n">users</span><span class="o">.</span><span class="nf">append</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="c1">// Include any logic that needs to occur when a document is changed on the server</span>
|
||||||
|
<span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">documentWasChanged</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">fields</span><span class="p">:</span><span class="kt">NSDictionary</span><span class="p">?,</span> <span class="nv">cleared</span><span class="p">:[</span><span class="kt">String</span><span class="p">]?)</span> <span class="p">{</span>
|
||||||
|
<span class="k">if</span> <span class="k">let</span> <span class="nv">index</span> <span class="o">=</span> <span class="n">contacts</span><span class="o">.</span><span class="nf">indexOf</span><span class="p">({</span> <span class="n">contact</span> <span class="k">in</span> <span class="k">return</span> <span class="n">contact</span><span class="o">.</span><span class="n">_id</span> <span class="o">==</span> <span class="n">id</span> <span class="p">})</span> <span class="p">{</span>
|
||||||
|
<span class="n">contact</span> <span class="o">=</span> <span class="n">contacts</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
|
||||||
|
<span class="n">contact</span><span class="o">.</span><span class="nf">update</span><span class="p">(</span><span class="n">fields</span><span class="p">)</span>
|
||||||
|
<span class="n">contacts</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> <span class="o">=</span> <span class="n">contact</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="c1">// Include any logic that needs to occur when a document is removed on the server</span>
|
||||||
|
<span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">documentWasRemoved</span><span class="p">(</span><span class="nv">collection</span><span class="p">:</span><span class="kt">String</span><span class="p">,</span> <span class="nv">id</span><span class="p">:</span><span class="kt">String</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">if</span> <span class="k">let</span> <span class="nv">index</span> <span class="o">=</span> <span class="n">contacts</span><span class="o">.</span><span class="nf">indexOf</span><span class="p">({</span> <span class="n">contact</span> <span class="k">in</span> <span class="k">return</span> <span class="n">contact</span><span class="o">.</span><span class="n">_id</span> <span class="o">==</span> <span class="n">id</span> <span class="p">})</span> <span class="p">{</span>
|
||||||
|
<span class="n">contacts</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> <span class="o">=</span> <span class="kc">nil</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>So far, we’re able to process documents that have been added, changed or removed on the server. But the UserCollection class still lacks the ability to make changes to both the local datastore and on the server. We’ll change that. In the UserCollection class, create a method called insert.</p>
|
||||||
|
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">UserCollection</span><span class="p">:</span> <span class="kt">AbstractCollection</span> <span class="p">{</span>
|
||||||
|
<span class="cm">/*
|
||||||
|
override public func documentWasAdded ...
|
||||||
|
override public func documentWasChanged ...
|
||||||
|
override public func documentWasRemoved ...
|
||||||
|
*/</span>
|
||||||
|
|
||||||
|
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">insert</span><span class="p">(</span><span class="nv">contact</span><span class="p">:</span> <span class="kt">Contact</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
|
||||||
|
<span class="c1">// (1) save the document to the contacts array</span>
|
||||||
|
<span class="n">contacts</span><span class="p">[</span><span class="n">contacts</span><span class="o">.</span><span class="n">_id</span><span class="p">]</span> <span class="o">=</span> <span class="n">contact</span>
|
||||||
|
|
||||||
|
<span class="c1">// (2) now try to insert the document on the server</span>
|
||||||
|
<span class="n">client</span><span class="o">.</span><span class="nf">insert</span><span class="p">(</span><span class="k">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="nv">document</span><span class="p">:</span> <span class="p">[</span><span class="n">contacts</span><span class="o">.</span><span class="nf">fields</span><span class="p">()])</span> <span class="p">{</span> <span class="n">result</span><span class="p">,</span> <span class="n">error</span> <span class="k">in</span>
|
||||||
|
|
||||||
|
<span class="c1">// (3) However, if the server returns an error, reverse the action on the client by</span>
|
||||||
|
<span class="c1">// removing the document from the contacts collection</span>
|
||||||
|
<span class="k">if</span> <span class="n">error</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
|
||||||
|
<span class="k">self</span><span class="o">.</span><span class="n">contacts</span><span class="p">[</span><span class="n">contact</span><span class="o">.</span><span class="n">_id</span><span class="p">]</span> <span class="o">=</span> <span class="kc">nil</span>
|
||||||
|
<span class="n">log</span><span class="o">.</span><span class="nf">error</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">error</span><span class="o">!</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>The key parts of this method are:
|
||||||
|
- (1) save the new contact to the array we created in UserCollection
|
||||||
|
- (2) invoke client.insert to initiate an insert on the server
|
||||||
|
- (3) remove the contact from the local store if the server rejects the insert</p>
|
||||||
|
|
||||||
|
<p>Creating update and remove methods are also easy to create, and follow the same patern as insert. For a more extensive example of the patterns shown here, have a look at <a href="https://github.com/siegesmund/SwiftDDP/blob/master/SwiftDDP/MeteorCollection.swift">MeteorCollection.swift</a>. MeteorCollection is an in-memory collection implementation suitable for simple applications.</p>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section id="footer">
|
||||||
|
<p>© 2016 <a class="link" href="https://github.com/siegesmund/SwiftDDP" target="_blank" rel="external">Peter Siegesmund</a>. All rights reserved. (Last updated: 2016-04-12)</p>
|
||||||
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,40 @@
|
||||||
|
window.jazzy = {'docset': false}
|
||||||
|
if (typeof window.dash != 'undefined') {
|
||||||
|
document.documentElement.className += ' dash'
|
||||||
|
window.jazzy.docset = true
|
||||||
|
}
|
||||||
|
if (navigator.userAgent.match(/xcode/i)) {
|
||||||
|
document.documentElement.className += ' xcode'
|
||||||
|
window.jazzy.docset = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// On doc load, toggle the URL hash discussion if present
|
||||||
|
$(document).ready(function() {
|
||||||
|
if (!window.jazzy.docset) {
|
||||||
|
var linkToHash = $('a[href="' + window.location.hash +'"]');
|
||||||
|
linkToHash.trigger("click");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// On token click, toggle its discussion and animate token.marginLeft
|
||||||
|
$(".token").click(function(event) {
|
||||||
|
if (window.jazzy.docset) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var link = $(this);
|
||||||
|
var animationDuration = 300;
|
||||||
|
var tokenOffset = "15px";
|
||||||
|
var original = link.css('marginLeft') == tokenOffset;
|
||||||
|
link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
|
||||||
|
$content = link.parent().parent().next();
|
||||||
|
$content.slideToggle(animationDuration);
|
||||||
|
|
||||||
|
// Keeps the document from jumping to the hash.
|
||||||
|
var href = $(this).attr('href');
|
||||||
|
if (history.pushState) {
|
||||||
|
history.pushState({}, '', href);
|
||||||
|
} else {
|
||||||
|
location.hash = href;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue