Skip to content

Commit

Permalink
programatically initialize rootviewcontroller
Browse files Browse the repository at this point in the history
  • Loading branch information
lazaronixon committed Nov 1, 2023
1 parent f4ebbb1 commit 8e0dd04
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ final class SceneDelegate: UIResponder {
// MARK: - Setup

private func configureRootViewController() {
navigationController = window!.rootViewController as? TurboNavigationController
navigationController.navigationBar.scrollEdgeAppearance = .init()
UINavigationBar.appearance().scrollEdgeAppearance = .init()

navigationController = TurboNavigationController()
navigationController.session = session
navigationController.modalSession = modalSession
window!.rootViewController = navigationController
}

// MARK: - Authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
</dependencies>
<scenes>
<!--Turbo Navigation Controller-->
<!--View Controller-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController id="Y6W-OH-hqX" customClass="TurboNavigationController" customModuleProvider="target" sceneMemberID="viewController"/>
<viewController id="Y6W-OH-hqX" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="130" y="-2"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,24 @@ final class SceneDelegate: UIResponder {
// MARK: - Setup

private func configureRootViewController() {
tabBarController = window!.rootViewController as? UITabBarController
tabBarController.tabBar.scrollEdgeAppearance = .init()
UINavigationBar.appearance().scrollEdgeAppearance = .init()

navigationController1 = tabBarController.viewControllers![0] as? TurboNavigationController
navigationController1.navigationBar.scrollEdgeAppearance = .init()
navigationController1 = TurboNavigationController()
navigationController1.tabBarItem = .init(title: nil, image: .init(systemName: "house"), tag: 0)
navigationController1.session = session1
navigationController1.modalSession = modalSession

navigationController2 = tabBarController.viewControllers![1] as? TurboNavigationController
navigationController2.navigationBar.scrollEdgeAppearance = .init()
navigationController2 = TurboNavigationController()
navigationController2.tabBarItem = .init(title: nil, image: .init(systemName: "house"), tag: 1)
navigationController2.session = session2
navigationController2.modalSession = modalSession

UITabBar.appearance().scrollEdgeAppearance = .init()

tabBarController = UITabBarController()
tabBarController.viewControllers = [navigationController1, navigationController2]

window!.rootViewController = tabBarController
}

// MARK: - Sessions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="33v-ad-2dz">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Turbo Navigation Controller-->
<scene sceneID="GwE-Ch-DRP">
<!--View Controller-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController id="cXb-wA-NUs" customClass="TurboNavigationController" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="" image="gear" catalog="system" id="rhZ-zi-yeq"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ife-PY-okT" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
<viewController id="Y6W-OH-hqX" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1271" y="-647"/>
</scene>
<!--Turbo Navigation Controller-->
<scene sceneID="pAD-IL-Hdw">
<objects>
<viewController id="0en-nE-vJA" customClass="TurboNavigationController" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="" image="house" catalog="system" id="ZWo-HO-m4a"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="GRr-XE-fAM" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1270" y="-1254"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="So3-hc-mhH">
<objects>
<tabBarController id="33v-ad-2dz" sceneMemberID="viewController">
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="fR1-GM-qEi">
<rect key="frame" x="0.0" y="0.0" width="393" height="49"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tabBar>
<connections>
<segue destination="0en-nE-vJA" kind="relationship" relationship="viewControllers" id="z0u-hS-Voh"/>
<segue destination="cXb-wA-NUs" kind="relationship" relationship="viewControllers" id="eJZ-00-JTF"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KRh-ez-iFz" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="364" y="-951"/>
<point key="canvasLocation" x="130" y="-2"/>
</scene>
</scenes>
<resources>
<image name="gear" catalog="system" width="128" height="122"/>
<image name="house" catalog="system" width="128" height="104"/>
</resources>
</document>

0 comments on commit 8e0dd04

Please sign in to comment.