This repository was archived by the owner on Jun 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Folders #7
Merged
Merged
Folders #7
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,26 @@ | ||
| // | ||
| // CoordinatorSwiftUI.swift | ||
| // Bookie | ||
| // | ||
| // Created by Roman Podymov on 27/04/2025. | ||
| // Copyright © 2025 Bookie. All rights reserved. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| class CoordinatorSwiftUI: Coordinator { | ||
| @MainActor | ||
| override class func createRootScreen( | ||
| searchText: String, | ||
| previousBook: Book? | ||
| ) -> (AnyBooksScreen & UIViewController) { | ||
| BooksScreenSwiftUI(searchText: searchText, previousBook: previousBook) | ||
| } | ||
|
|
||
| @MainActor | ||
| override class func createDetailScreen( | ||
| _ data: Book | ||
| ) -> (AnyBookScreen & UIViewController) { | ||
| BookScreenSwiftUI(data) | ||
| } | ||
| } |
This file contains hidden or 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,53 @@ | ||
| // | ||
| // DI.swift | ||
| // Bookie | ||
| // | ||
| // Created by Roman Podymov on 27/04/2025. | ||
| // Copyright © 2025 Bookie. All rights reserved. | ||
| // | ||
|
|
||
| import Fashion | ||
| import SwiftData | ||
| @preconcurrency import Swinject | ||
| import Then | ||
| import UIKit | ||
|
|
||
| protocol AnyCoordinator { | ||
| func set(window: UIWindow) | ||
| func openHomeScreen(previousBook: Book?) async | ||
| func openDetailScreen(_ data: Book, searchText: String) async | ||
| } | ||
|
|
||
| protocol RemoteDataSource { | ||
| func search(text: String) async throws (BooksViewModelError) -> BookResponse | ||
| } | ||
|
|
||
| protocol LocalDataSource: RemoteDataSource { | ||
| func save(books: [Book]) async throws (BooksViewModelError) | ||
| } | ||
|
|
||
| extension Container: @retroactive Then {} | ||
|
|
||
| let dependenciesContainer = Container().then { result in | ||
| let objectScope: ObjectScope = .container | ||
| result.register(AnyCoordinator.self) { _ in | ||
| CoordinatorSwiftUI() | ||
| }.inObjectScope(objectScope) | ||
| result.register(Stylesheet.self) { _ in | ||
| MainStylesheet() | ||
| }.inObjectScope(objectScope) | ||
| result.register(RemoteDataSource.self) { _ in | ||
| GoogleRemoteDataSource() | ||
| }.inObjectScope(objectScope) | ||
| result.register(LocalDataSource.self) { _ in | ||
| if #available(iOS 17, *), let container = { | ||
| let configuration = ModelConfiguration(for: BookSwiftData.self) | ||
| let schema = Schema([BookSwiftData.self]) | ||
| return try? ModelContainer(for: schema, configurations: [configuration]) | ||
| }() { | ||
| SwiftDataSource(modelContainer: container) | ||
| } else { | ||
| RealmDataSource() | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.