Project Catalyst does not support Firebase - MacOS

761 views
Skip to first unread message

Chaudhry Talha

unread,
Oct 24, 2019, 10:17:07 AM10/24/19
to Firebase Google Group
Working with the latest feature of xCode called project catalyst made me realize Firebase doesn't work with it. Or maybe I'm mistaken so I'm posting it here if anyone know a feasible solution of integrating Firebase with Project Catalyst in XCode.
Screen Shot 2019-10-24 at 11.34.00 AM.png

Paul Beusterien

unread,
Oct 24, 2019, 5:24:46 PM10/24/19
to Firebase Google Group
Firebase does have community support for macOS.  See https://github.com/firebase/firebase-ios-sdk#macos-and-tvos.  Firebase module support - related to the build failure you're seeing - was just added in the latest 6.11.0 release.

Catalyst is also community supported and a bit more immature than old-style Mac support.  Catalyst support is evolving quickly and details can be followed in the umbrella issue and more broadly in the set of Catalyst tagged issues.  With some workarounds, most of the open source part of Firebase is functional for Catalyst.
Message has been deleted

Jay

unread,
Oct 25, 2019, 5:11:32 PM10/25/19
to Firebase Google Group
This isn't directly related to Catalyst but in case someone is looking for Firebase/Firestore on macOS, it works and I've been running it for about a year.

The podfile will look like this

project 'MacFirebase.xcodeproj'
platform
:osx, '10.14'
target
'MacFirebase' do
  use_frameworks
!
  pod
'FirebaseCore'
  pod
'FirebaseAuth'
  pod
'FirebaseDatabase'
  pod
'FirebaseStorage'
end


there are a few more pods available as well (Firestore for example).

Do NOT initialize Firebase in the app delegate. Do it in the main viewController

import Cocoa
import FirebaseCore
import FirebaseAuth
import FirebaseDatabase
import FirebaseStorage


class ViewController: NSViewController {
   
var ref: DatabaseReference!

   
override func viewDidLoad() {
       
super.viewDidLoad()

       
FirebaseApp.configure()
       
self.ref = Database.database().reference()

        let version
= Database.sdkVersion()
       
print("Firebase Version \(version)") //just prints the current Firebase version

       
self.authToFirebase() //auth yourself
   
}

Joe Kim

unread,
Jan 21, 2020, 8:37:21 PM1/21/20
to Firebase Google Group
Hi Jay,

Why not initialize Firebase in the app delegate? Is it a timing issue? Does it just need to happen a little later?

Is it possible to run in a server like Vapor?

Thanks,
Joe

Jay

unread,
Jan 22, 2020, 4:02:49 PM1/22/20
to Firebase Google Group
The loading sequence is different iOS vs macOS.

With iOS, the app delegate didFinishLaunchingWithOptions executes before the mainView controllers viewDidLoad

1) func application(_ application: UIApplication, didFinishLaunchingWithOptions 
2) override func viewDidLoad() {

whereas with macOS, the main viewController viewDidLoad executes before the delegate applicationDidFinishLaunching

1) override func viewDidLoad() {
2) func applicationDidFinishLaunching

So yes, it's a timing thing so you need to 'back up' the Firebase initialization.

Often times you start to work with Firebase in viewDidLoad - for example to populate a tableView dataSource, so before that's called Firebase needs to be ready and viewDidLoad seems to work best for macOS apps.

It sure would be cool if Firebase officially supported macOS. ...ehm...
Reply all
Reply to author
Forward
0 new messages