mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-03 17:19:42 -05:00
32 lines
1.1 KiB
Swift
32 lines
1.1 KiB
Swift
// ios/CarScene.swift
|
|
import Foundation
|
|
import CarPlay
|
|
|
|
class CarSceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
|
|
func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) {
|
|
|
|
if let applicationDelegate = UIApplication.shared.delegate as? AppDelegate {
|
|
|
|
if applicationDelegate.bridge == nil {
|
|
|
|
applicationDelegate.bridge = RCTBridge.init(delegate: applicationDelegate, launchOptions: [:])
|
|
|
|
applicationDelegate.rootView = RCTRootView.init(
|
|
bridge: applicationDelegate.bridge!,
|
|
moduleName: "Jellify",
|
|
initialProperties: nil
|
|
)
|
|
}
|
|
}
|
|
|
|
RNCarPlay.connect(with: interfaceController, window: templateApplicationScene.carWindow);
|
|
|
|
}
|
|
|
|
func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didDisconnectInterfaceController interfaceController: CPInterfaceController) {
|
|
|
|
RNCarPlay.disconnect()
|
|
|
|
}
|
|
}
|