UIColletionViewController

swift
ios

#1

Я новичок в программирований. Помогите разобраться с UIColletionViewController, есть 4 Controller

  1. UIViewController,
  2. UITabBarController,
  3. и 2 UIColletionViewController.
    Есть переход с UIViewController в UITabBarController и он создает 2 UIColletionViewController и тогда выходит ошибка: ‘UICollectionView must be initialized with a non-nil layout parameter’. Гуглил ошибку но что то не очень. Помогите =) P.S: код пишу без StoryBoard

AppDelegate:

class CustomNavigationController: UINavigationController {
override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
  }
}

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?
var navigationController: UINavigationController?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
    window = UIWindow(frame: UIScreen.main.bounds)
    
    if let window = window {
        let mainVC = MainScreenController()
        navigationController = CustomNavigationController(rootViewController: mainVC)
        window.rootViewController = navigationController
        window.makeKeyAndVisible()
    }
   
    UINavigationBar.appearance().isTranslucent = false
    UINavigationBar.appearance().tintColor = .white
    UINavigationBar.appearance().barTintColor = UIColor.darkBlue
    UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
    UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
         
    FirebaseApp.configure()
    return true
}