結論
~App.swiftを、こう書きましょう。
①〜③の順番でプログラムを書いてみましょう。
~App.swift
import SwiftUI
import FirebaseCore // ① : Firebaseのセッティング
struct FirebaseCloudMessagingPracticeApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate // ③ : Firebaseのセッティング
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
// ② : Firebaseのセッティング
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
FirebaseApp.configure()
return true
}
}