Skip to content

Commit

Permalink
(DOCSP-39501): Consolidate Quick Start page (#3280)
Browse files Browse the repository at this point in the history
## Pull Request Info - SDK Docs Consolidation

Jira ticket: https://jira.mongodb.org/browse/DOCSP-39501

*Staged Page*

- [Quick
Start](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39501/sdk/quick-start/)
- [SwiftUI Quick
Start](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39501/frameworks/swiftui/quick-start/):
Existing content ported over with Realm naming and ref updates
- [Flutter Quick
Start](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39501/frameworks/flutter/quick-start/):
Move existing Flutter-specific content out of quick start to this
relevant section
- [Unity Quick
Start](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39501/platforms/unity/):
Existing content ported over with Realm naming and ref updates

Adding a note here to capture this in the PR record:
- Product has made the call to remove Java SDK info from our "getting
started" content (here and the Install page), so I've removed the Java
and Kotlin (Java SDK) examples from the consolidated quick start page.
- Based on relatively low usage of the Java SDK Quick Start with
LiveData page, and the need to update it to show Kotlin SDK or at the
very least not Partition-Based Sync, I've checked with engineering and
product and am removing this page from the docs. It doesn't seem
worthwhile to continue to incur the maintenance cost.

*Page Source*

Add links to every SDK's pages where you got the SDK-specific
information:

- [C++ Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/cpp/quick-start/)
- [Flutter Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/quick-start/)
- [Flutter Install
Page](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/install/)
- [Java Local Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/java/quick-starts/quick-start-local/)
- [Java Sync Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/java/quick-starts/quick-start-sync/)
- [Java Quick Start with Live
Data](https://www.mongodb.com/docs/atlas/device-sdks/sdk/java/quick-starts/livedata/)
- [Kotlin Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/quick-start/)
- [.NET Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/quick-start/)
- [.NET SDK/Quick Start for
Unity](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/unity/)
- [Node.js Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/quick-start/)
- [Swift Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/quick-start/)
- [SwiftUI Quick
Start](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/swiftui-tutorial/)

### PR Author Checklist

Before requesting a review for your PR, please check these items:

- [x] Open the PR against the `feature-consolidated-sdk-docs` branch
instead of `master`
- [x] Tag the consolidated page for:
  - genre
  - meta.keywords
  - meta.description

#### Naming
- [x] Update Realm naming and the language around persistence
layer/local/device per [this
document](https://docs.google.com/document/d/126OczVxBWAwZ4P5ZsSM29WI3REvONEr1ald-mAwPtyQ/edit?usp=sharing)
- [x] Include `.rst` files comply with [the naming
guidelines](https://docs.google.com/document/d/1h8cr66zoEVeXytVfvDxlCSsUS5IZwvUQvfSCEXNMpek/edit#heading=h.ulh8b5f2hu9)

#### Links and Refs
- [x] Create new consolidated SDK ref targets starting with "_sdks-" for
relevant sections
- [x] Remove or update any SDK-specific refs to use the new consolidated
SDK ref targets
- [x] [Update any Kotlin API
links](https://jira.mongodb.org/browse/DOCSP-32519) to use the new
Kotlin SDK roles

#### Content
- [x] Shared code boxes have snippets or placeholders for all 9
languages
- [x] API description sections have API details or a generic placeholder
for all 9 languages
- [x] Check related pages for relevant content to include
- [x] Create a ticket for missing examples in each relevant SDK:
Consolidation Gaps epic

### Reviewer Checklist

As a reviewer, please check these items:

- [ ] Shared code example boxes contain language-specific snippets or
placeholders for every language
- [ ] API reference details contain working API reference links or
generic content
- [ ] Realm naming/language has been updated
- [ ] All relevant content from individual SDK pages is present on the
consolidated page

---------

Co-authored-by: cbullinger <[email protected]>
  • Loading branch information
dacharyc and cbullinger authored Jun 18, 2024
1 parent 97d3e5b commit 8ee6c6b
Show file tree
Hide file tree
Showing 60 changed files with 2,163 additions and 29 deletions.
10 changes: 3 additions & 7 deletions source/frameworks/flutter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
Build with Flutter
==================

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol
.. toctree::
:titlesonly:

Placeholder page for information about building with Flutter. (This may
be a directory depending on how much content we have/need.)
Quick Start </frameworks/flutter/quick-start>
110 changes: 110 additions & 0 deletions source/frameworks/flutter/quick-start.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.. _frameworks-flutter-quick-start:

========================
Quick Start with Flutter
========================

.. meta::
:description: Get started using Atlas Device SDK with Flutter in a Flutter application.
:keywords: Realm, Flutter, Flutter SDK, code example

.. facet::
:name: genre
:values: tutorial

.. facet::
:name: programming_language
:values: dart

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol

This quick start demonstrates how to use Atlas Device SDK with Flutter in a
Flutter application.

.. tip:: Flutter Project or Standalone Dart Project?

This quick start contains information for using the SDK in a Flutter
project. The package that you import and the way you create object
models differs when using the SDK in a standalone Dart project. For
a quick start using a standalone Dart project, refer to
:ref:`sdks-quick-start`.

Install the SDK
---------------

Install the ``realm`` package for use in Flutter applications. For more
information about installing the SDK in a Flutter project, refer to
:ref:`sdks-install`.

Import the SDK
--------------

Import the ``realm`` package into any files where you use it.

.. code-block:: dart
:caption: ExampleFile.dart

import 'package:realm/realm.dart';

Define Your Object Model
------------------------

Your application's **data model** defines the structure of data stored within
the database. You can define your application's data model via Dart
classes in your application code with an SDK object schema.
You then have to generate the :flutter-sdk:`RealmObjectBase <realm/RealmObjectBase-mixin.html>`
class that's used within your application.

For more information, refer to :ref:`Define an Object Schema
<sdks-define-object-schema>`.

.. procedure::

.. step:: Create a Model Class

Add an SDK model class. Give your class a private name
(starting with ``_``), such as a file ``car.dart`` with a class
``_Car``.

.. literalinclude:: /examples/generated/flutter/car.snippet.define-model-flutter.dart
:language: dart
:caption: car.dart

.. step:: Generate an SDK Object Class

Generate a RealmObject class ``Car`` from the data model class ``_Car``:

.. code-block::

dart run realm generate

Running this creates a ``Car`` class in a ``car.realm.dart`` file
located in the directory where you defined the model class. This ``Car``
class is public and part of the same library as the ``_Car`` data model
class. The generated ``Car`` class is what's used throughout your
application.

.. step:: Watch for Changes to the Model (Optional)

You can watch your data model class to generate a new ``Car`` class
whenever there's a change to ``_Car``:

.. code-block::

dart run realm generate --watch

Perform CRUD Operations and More
--------------------------------

Installing the library and the commands to generate the models are specific
to using the SDK with a Flutter project or a standalone Dart project. But
all the other operations, from reading and writing data to syncing data across
devices, are the same for a Flutter or standalone Dart project.

To learn more about performing these operations, refer to the main Quick Start.
Shared content starts with the :ref:`Open a Database <sdks-quick-start-open-database>`
section.
11 changes: 3 additions & 8 deletions source/frameworks/swiftui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
Build with SwiftUI
==================

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol
.. toctree::
:titlesonly:

Placeholder page for information about building with SwiftUI.

This will be a directory with SwiftUI content.
Quick Start </frameworks/swiftui/quick-start>
Loading

0 comments on commit 8ee6c6b

Please sign in to comment.