Skip to content

Sample applications for realm-swift database

Notifications You must be signed in to change notification settings

realm/realm-swift-samples

Repository files navigation

realm by MongoDB

License

Realm Swift Samples

This repo contains Swift Samples that demonstrate the usage of Realm Swift SDK.

Realm Swift documentation can be found here and API reference here.

To install Realm Swift SDK you can consult our Installation documentation or our Get Started on our repository. You may find the Quick Start - Realm Swift helpful if you are using Realm for the first time as well.

To learn more about using Realm with Atlas App Services, refer to the Atlas Device Sync and connecting to Atlas App Services documentation.

Samples list

  • Sync connection state changes, Error handling, and Client reset Sample App - This project implements a simple example App which showcases the following use cases:

    • Listening for user state changes (logged in, logged out, or removed).
    • Listening if the underlying sync session state, is active, inactive or invalid.
    • Listening if the underlying sync session connection state is connecting, connected, disconnected.
    • Listening for sync errors using sync's error handler.
    • Listening for pre and post client resets blocks with .recoverOrDiscardUnsyncedChanges mode.
  • Analytics/Telemetric Data - The app addresses the following points:

    • Use asymmetric sync to be able to send data uni-directionally to MongoDB Atlas.
    • Configure an App to be able to send asymmetric data.
    • Be able to send events/data easily/fast during the app life cycle.
    • Track easily events/screen views/clicks on a SwiftUI context.
    • Model data to be displayable in MongoDB Charts.
  • Offline Login/Realm Access - This simple sample project showcase the following use cases:

    • Register/Login a Device Sync user.
    • Access a already logged user without an internet connection.
    • Opening a Realm with and without and internet connection.
    • Add an initial flexible sync subscription, which executes when opening a realm for the very first time, even if offline.
    • Logging out a Device Sync user and resetting your SwiftUI's associated Realm when doing so.
  • Apple SignIn and Authentication - This simple sample project showcase the following example:

    • Use Apple Sign In implementation in order to authenticate users in Realm/Device-Sync.
      • Log screen view in UIKit.
      • Authenticate users in Realm/Device-Sync using the RealmSwift SDK.
  • Integrating In-App Purchases with Atlas App Services using Flexible Sync

    • The scope of this app aims to demonstrate the effortless integration between Realm Device Sync, offering efficient data management and synchronization, and StoreKit for handling in-app purchases. The goal is to achieve a robust implementation that enables users to buy recipes stored in a Realm Database. After confirming the purchase through StoreKit, users can unlock premium content recipes and conveniently store purchase receipts on a separate collection for easy access on the developer's side in Atlas.
    • In this project you will be able to see an example of the following use case:
      • Authenticate users using the Swift SDK.
      • Fetch data into your app using Flexible Sync.
      • Purchase non-consumable products.
      • Fetch all receipts from purchases and view them on Atlas.

About

Sample applications for realm-swift database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published