-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from MobileUpLLC/UPUP-692-memory-leak
Upup 692 memory leak
- Loading branch information
Showing
17 changed files
with
381 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// AppDelegate.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 25.11.2024. | ||
// | ||
|
||
import UIKit | ||
|
||
@main | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
func application( | ||
_ application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
) -> Bool { | ||
|
||
return true | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// HostingController.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 27.11.2024. | ||
// | ||
|
||
import SwiftUI | ||
import UIKit | ||
|
||
class HostingController<T: View>: UIHostingController<T> { | ||
override init(rootView: T) { | ||
super.init(rootView: rootView) | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
view.backgroundColor = .clear | ||
} | ||
|
||
override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
} | ||
|
||
@available(*, unavailable) @MainActor dynamic required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// SceneDelegate.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 25.11.2024. | ||
// | ||
|
||
import UIKit | ||
|
||
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 { | ||
return | ||
} | ||
|
||
window = UIWindow(windowScene: windowScene) | ||
window?.windowScene = windowScene | ||
window?.makeKeyAndVisible() | ||
|
||
let rootViewController = StartFactory.createStartController() | ||
|
||
window?.rootViewController = rootViewController | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
ExampleApp/ExampleApp/UI/ContentScreen/ContentController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// ContentController.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 27.11.2024. | ||
// | ||
|
||
import SwiftUI | ||
|
||
class ContentController: HostingController<ContentView> { | ||
init(viewModel: ContentViewModel) { | ||
super.init(rootView: ContentView(viewModel: viewModel)) | ||
print("init ContentController") | ||
} | ||
|
||
deinit { | ||
print("deinit ContentController") | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
ExampleApp/ExampleApp/UI/ContentScreen/ContentCoordinator.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// ContentCoordinator.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 27.11.2024. | ||
// | ||
|
||
import UIKit | ||
|
||
class ContentCoordinator { | ||
weak var router: UIViewController? | ||
|
||
func pop() { | ||
router?.navigationController?.popViewController(animated: true) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
ExampleApp/ExampleApp/UI/ContentScreen/ContentFactory.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// ContentFactory.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 27.11.2024. | ||
// | ||
|
||
import UIKit | ||
|
||
enum ContentFactory { | ||
static func createContentController() -> UIViewController { | ||
let coordinator = ContentCoordinator() | ||
let viewModel = ContentViewModel(coordinator: coordinator) | ||
let controller = ContentController(viewModel: viewModel) | ||
|
||
coordinator.router = controller | ||
|
||
return controller | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
ExampleApp/ExampleApp/UI/StartScreen/StartController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// StartController.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 27.11.2024. | ||
// | ||
|
||
import UIKit | ||
|
||
class StartController: HostingController<StartView> { | ||
init(viewModel: StartViewModel) { | ||
super.init(rootView: StartView(viewModel: viewModel)) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
ExampleApp/ExampleApp/UI/StartScreen/StartCoordinator.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// StartCoordinator.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 27.11.2024. | ||
// | ||
|
||
import UIKit | ||
|
||
class StartCoordinator { | ||
weak var router: UIViewController? | ||
|
||
func push() { | ||
let controller = ContentFactory.createContentController() | ||
router?.navigationController?.pushViewController(controller, animated: true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// StartFactory.swift | ||
// Example | ||
// | ||
// Created by Victor Kostin on 27.11.2024. | ||
// | ||
|
||
import UIKit | ||
|
||
enum StartFactory { | ||
static func createStartController() -> UINavigationController { | ||
let coordinator = StartCoordinator() | ||
let viewModel = StartViewModel(coordinator: coordinator) | ||
let controller = StartController(viewModel: viewModel) | ||
|
||
coordinator.router = controller | ||
|
||
return UINavigationController(rootViewController: controller) | ||
} | ||
} |
Oops, something went wrong.