1. Home
  2. Docs
  3. UberEats Clone – Documentation
  4. Common Customizations
  5. Integrating a different backend

Integrating a different backend

First of all, make sure you’ve read about our generic data sources. The generic data sources are the components that interact with the backend, and provide the fetched data back into the view controllers.

MultiVendorDataSourceProvider is the class the contains all of the data sources used in the UberEats clone.

This is one of the most important files of the app, since it provides the data sources for all the screens in the app. By default, our app is integrated with Firebase, so the data sources returned by default are Firebase. If you do disable the Firebase integration in the serverConfig, this class will return hardcoded data sources.

For example, this is how the data source provider for fetching the reviews of a restaurant looks like:

func reviewsDataSource(for vendor: ATCVendor) -> ATCGenericCollectionViewControllerDataSource {
    if serverConfig.isFirebaseDatabaseEnabled {
        return ATCFirebaseFirestoreDataSource<ATCReview>(tableName: serverConfig.firebaseVendorReviewsTableName,
                                                         conditions: ["entityID": vendor.id],
                                                         limit: nil,
                                                         additionalFilterBlock: nil)
    }
    return ATCGenericLocalDataSource<ATCReview>(items: [])
}

Notice how, if Firebase enabled, we return a Firestore data source fetching the reviews based on the vendor’s ID. If Firebase is not enabled, we’ll just show an empty list of reviews.

This is how you integrate a different backend into the app! All you need to do is return your own custom data source instead of these two, and you’re golden.

So in order to integrate the iOS app with your own custom backend, you need to:

  1. Create a data source for each data source method in MultiVendorDataSourceProvider
  2. Override the implementation of all data source methods in MultiVendorDataSourceProvider to return your own data sources

This is extremely straightforward, and it keeps the code highly modularized. If you ever want to switch to a different backend again, you’ll only need to change this file, and nothing else.

A few examples of types of backends that you might want to use and that are fully compatible with our approach:

  • REST API
  • GraphQL
  • Firebase
  • AWS
  • Microsoft Azure
  • Parse Server
  • CoreData
  • Realm
  • Disk files
  • SQL Database / SQLite
  • Hardcoded static data
  • Various SDKs (e.g. Backendless, Serverless, etc)
  • WooCommerce / Shopify / WordPress
  • etc