Skip to content

Commit bbe73fc

Browse files
author
Chris Cho
authored
DOCSP-10619: update Swift landing page for 1.0 (#644)
* DOCSP-10619: update Swift landing page for 1.0
1 parent 09fe06c commit bbe73fc

File tree

3 files changed

+46
-16
lines changed

3 files changed

+46
-16
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
The MongoDB Swift driver requires Swift 5 or later.
1+
The MongoDB Swift driver requires **Swift 5.1** or later.

source/includes/mongodb-compatibility-table-swift.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- MongoDB 3.0
1313
- MongoDB 2.6
1414

15-
* - 0.2.0
15+
* - 1.0.0
1616
- |checkmark|
1717
- |checkmark|
1818
- |checkmark|

source/swift.txt

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ Introduction
1919

2020
This is the official MongoDB Swift Driver.
2121

22-
.. admonition:: Alpha Release
23-
:class: important
24-
25-
The MongoDB Swift Driver is currently in alpha.
26-
27-
- `Usage Guide <https://mongodb.github.io/mongo-swift-driver/index.html#example-usage>`__
22+
- `Usage Guide <https://github.com/mongodb/mongo-swift-driver#example-usage>`__
2823

2924
- `API Reference <https://mongodb.github.io/mongo-swift-driver>`__
3025

@@ -36,24 +31,59 @@ This is the official MongoDB Swift Driver.
3631
Installation
3732
------------
3833

39-
See `Installation <https://mongodb.github.io/mongo-swift-driver/index.html#installation>`__
34+
See `Installation <https://github.com/mongodb/mongo-swift-driver#installation>`__
4035

4136

4237
Connect to MongoDB Atlas
4338
------------------------
4439

4540
.. include:: /includes/atlas-connect-blurb.rst
4641

47-
.. code-block:: swift
42+
.. tabs::
43+
44+
.. tab:: Synchronous API
45+
:tabid: swift-sync
46+
47+
.. code-block:: swift
48+
49+
import MongoSwiftSync
50+
51+
defer {
52+
// free driver resources
53+
cleanupMongoSwift()
54+
}
55+
56+
let client = try MongoClient("mongodb+srv://<username>:<password>@<cluster-url>/test?retryWrites=true&w=majority")
57+
let db = client.db("myDB")
58+
59+
// your application logic
60+
61+
.. tab:: Asynchronous API
62+
:tabid: swift-async
63+
64+
.. code-block:: swift
65+
66+
import MongoSwift
67+
import NIO
68+
69+
let elg = MultiThreadedEventLoopGroup(numberOfThreads: 4)
70+
let client = try MongoClient(
71+
"mongodb+srv://<username>:<password>@<cluster-url>/test?retryWrites=true&w=majority",
72+
using: elg
73+
)
74+
75+
defer {
76+
// clean up driver resources
77+
try? client.syncClose()
78+
cleanupMongoSwift()
4879

49-
import MongoSwift
80+
// shut down EventLoopGroup
81+
try? elg.syncShutdownGracefully()
82+
}
5083

51-
let client = try MongoClient("mongodb+srv://<username>:<password>@<cluster-url>/test?retryWrites=true&w=majority")
52-
let db = client.db("test")
84+
let db = client.db("myDB")
5385

54-
// your application logic
55-
// free all resources
56-
cleanupMongoSwift()
86+
// your application logic
5787

5888
Compatibility
5989
-------------

0 commit comments

Comments
 (0)