Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Clean up demo project (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
joemasilotti authored Oct 1, 2023
1 parent 40040fe commit 47a5415
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 deletions.
8 changes: 0 additions & 8 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
isa = PBXGroup;
children = (
8484C2E729B132D20018596C /* Demo */,
8484C2FE29B133880018596C /* Frameworks */,
8484C2FC29B132E90018596C /* Packages */,
8484C2E629B132D20018596C /* Products */,
);
Expand Down Expand Up @@ -74,13 +73,6 @@
name = Packages;
sourceTree = "<group>";
};
8484C2FE29B133880018596C /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down
8 changes: 1 addition & 7 deletions Demo/Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import UIKit

@main
class AppDelegate: UIResponder {}

extension AppDelegate: UIApplicationDelegate {
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
}
class AppDelegate: UIResponder, UIApplicationDelegate {}
26 changes: 8 additions & 18 deletions Demo/Demo/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
import Turbo
import TurboNavigator
import UIKit
import WebKit

let baseURL = URL(string: "http://localhost:3000")!

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene
else { fatalError("Expected a UIWindowScene.") }

createWindow(in: windowScene)
}

// MARK: - Private

private let baseURL = URL(string: "http://localhost:3000")!
private lazy var turboNavigator = TurboNavigator(delegate: self, pathConfiguration: pathConfiguration)
private lazy var pathConfiguration = PathConfiguration(sources: [
.server(baseURL.appendingPathComponent("/configuration"))
])

private func createWindow(in windowScene: UIWindowScene) {
let window = UIWindow(windowScene: windowScene)
window.backgroundColor = .white
self.window = window
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }

window.makeKeyAndVisible()
window.rootViewController = turboNavigator.rootViewController
self.window = UIWindow(windowScene: windowScene)
self.window?.makeKeyAndVisible()

turboNavigator.route(baseURL)
self.window?.rootViewController = self.turboNavigator.rootViewController
self.turboNavigator.route(baseURL)
}
}

Expand Down

0 comments on commit 47a5415

Please sign in to comment.