I am new in Swift. I have 3 UIViewControllers
:
MainScreenController
RegistrationFormController
LoginFormController
and 1 UITabBarController
MainTabBarController
and 2 ColletionViewControllers
:
VideoController
TopVideoController
When I click on the button on the LoginFormController
to open MainTabBarController
with either 2 ColletionViewControllers
seems an error, the error is mentioned below:
'UICollectionView must be initialized with a non-nil layout parameter'
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
}
Help me to understand how it works.