Other Backends: Firebase, CloudKit and Sign in with Apple

IOS Development 9 min min read Updated: Nov 16, 2026 Intermediate
Other Backends: Firebase, CloudKit and Sign in with Apple
Intermediate Topic 7 of 7

Do You Need a Backend?

Many apps work fully on the device. You need a backend when users need accounts, shared data between people, or sync across devices.

OptionGood forNotes
SwiftData + CloudKitSync between a user's own devicesNo server code, Apple only
CloudKit public/shared DBSimple sharing between usersApple platforms only
FirebaseAccounts, database, storage, analytics, pushFast to start, works across Android and web
Your own REST APIFull control, company backendUse URLSession and Codable

Adding Firebase (Overview)

  1. Create a project at the Firebase console and add an iOS app with your bundle id.
  2. Download GoogleService-Info.plist and drag it into Xcode.
  3. Add the package https://github.com/firebase/firebase-ios-sdk using File > Add Package Dependencies.
  4. Choose the libraries you need, for example FirebaseAuth and FirebaseFirestore.
swift import SwiftUI import FirebaseCore class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { FirebaseApp.configure() return true } } @main struct MyApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate var body: some Scene { WindowGroup { ContentView() } } }
swift import FirebaseAuth import FirebaseFirestore // Sign up let result = try await Auth.auth().createUser(withEmail: email, password: password) print(result.user.uid) // Save a document try await Firestore.firestore().collection("notes").document(UUID().uuidString) .setData(["text": "Hello", "createdAt": Timestamp(date: .now)]) // Read documents let snapshot = try await Firestore.firestore().collection("notes").getDocuments() let texts = snapshot.documents.compactMap { $0["text"] as? String }
Security rules: Always set Firestore security rules so users can only read and write their own data. Never leave a database open to everyone.

Sign in with Apple

Apps that offer third-party sign-in options (such as Google or Facebook) are required by the App Store guidelines to also offer Sign in with Apple or an equivalent privacy-focused option. Check the current guideline text before you submit.

swift import AuthenticationServices SignInWithAppleButton(.signIn) { request in request.requestedScopes = [.fullName, .email] } onCompletion: { result in switch result { case .success(let auth): if let credential = auth.credential as? ASAuthorizationAppleIDCredential { let userID = credential.user // stable ID for this user print("Signed in: \(userID)") } case .failure(let error): print(error.localizedDescription) } } .frame(height: 50)

Add the Sign in with Apple capability in Signing & Capabilities first.

Advice: For a learning project start with SwiftData only. Add a backend later when a real need appears.

Conclusion

Choose the simplest backend that solves your problem. SwiftData with CloudKit for private sync, Firebase for cross-platform accounts and data, or your own API for full control.

Quick Summary: Use CloudKit for private sync, Firebase for fast cloud features and Sign in with Apple for privacy-friendly login.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators