Learn Courses My Dashboard

Webshop app with Core data?

Hi everyone. I have a question. I am a beginner and I am currently developing a webshop iOS application in Swift. Data is pulled from the Magento backend, via GraphQL and the Apollo client. I need the application to download all data about products and prices while it is online, but to be able to work later in offline mode as well. So when he returns to the online mode, to withdraw all changes and if there are any, to write them in Core Data. Is Core Data a good choice for such a thing? Or can you suggest something else for that thing? Thanks

Welcome to the community!

What do you mean “webshop iOS app?”

Check in what Apollo has for options, for caching data, I think it does this automatically for you

1 Like

It sounds like you’re looking for a solution to handle data synchronization between your online and offline states in your iOS application. Although Core Data is a good choice for many applications, you might also want to consider using Realm for this purpose.

Realm is a popular, powerful, and easy-to-use mobile database that can be a great alternative to Core Data. It offers robust support for offline-first applications like your webshop app, and it can simplify data management and synchronization.

Here are some advantages of using Realm in your scenario:

  1. Easy to use: Realm’s API is straightforward and easy to learn, especially for beginners. It provides a clean, object-oriented interface that can help you get up and running quickly.
  2. Cross-platform: Realm supports multiple platforms, including iOS, Android, and React Native. This can be advantageous if you plan to expand your application to other platforms in the future.
  3. Real-time synchronization: Realm offers the Realm Sync feature, which enables real-time, bidirectional data synchronization between your mobile app and backend server. When your app is online, changes are synced automatically. When offline, Realm stores changes locally, and the sync resumes once the device is back online.
  4. Performance: Realm is known for its performance and efficiency, especially when handling large datasets.
  5. Flexible schema: Realm allows you to define your data model using Swift classes, and it supports flexible schema updates, making it easier to evolve your data model as your application grows.

To implement Realm in your application, follow these steps:

  1. Install Realm: Add the RealmSwift package to your project using Swift Package Manager, CocoaPods, or Carthage. You can google who to install Realm to learn more.
  2. Define your data model: Create Swift classes that inherit from Object and define your properties. Use the @Persisted property wrapper for your fields.
  3. Set up your Realm instance: Instantiate a Realm object, which represents your local database.
  4. Perform CRUD operations: Use the Realm instance to add, update, delete, and query objects.
  5. Implement Realm Sync (optional): If you want to use the synchronization features, you will need to set up the Realm Object Server and configure your app to use it.

In conclusion, Realm can be a great choice for your webshop iOS application, particularly if you require seamless data synchronization between online and offline states. Its ease of use, performance, and flexibility make it a strong contender for this kind of project.


  1. Stewart Lynch: Realm+SwiftUI-1: PropertyWrappers - Part 1 - YouTube
  2. Karin Prater: Swift Realm Tutorial: How to use a local realm database with SwiftUI - iOS Basics - YouTube
1 Like

Thank you mikaelcaron for your answer, I will read the whole Apollo docs

Thanks for such a comprehensive answer. Yes, that’s exactly what I need. I did some research and compared Core Data and Realm solutions. Both have their advantages, and I don’t think I’ll go wrong using either one. It was only important for me to know if it can be used for what I needed.
Honestly, Realm is easy to use, but I would still avoid a 3rd party solution at this point. After all, Core Data is Apple’s framework. Although I haven’t decided anything yet. Thanks again for your help

1 Like