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
| class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
| var window: UIWindow? | |
| func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
| if let windowScene = scene as? UIWindowScene { | |
| let window = UIWindow(windowScene: windowScene) | |
| let controller = UIHostingController(rootView: | |
| StoreProvider(store: store) { |
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
| import Foundation | |
| import SwiftUI | |
| import Combine | |
| import TinyNetworking | |
| final class RemoteValue<A>: BindableObject { | |
| let didChange = MyPublisher() | |
| let endpoint: Endpoint<A> | |
| var value: A? { | |
| didSet { |
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
| struct SearchField : View { | |
| @Binding var searchText: String | |
| let placeholder: Text | |
| let onUpdateSearchText: (String) -> Void | |
| func onKeyStroke() { | |
| onUpdateSearchText(searchText) | |
| } | |
| var body: some View { |
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
| if let vc = Storyboards.Controllers.booksCollection.instantiate() as? BooksCollectionViewController { | |
| vc.booksCollectionDataProvider = BooksCollectionAllBooksDataProvider(user: user) | |
| parentVC.navigationController?.pushViewController(vc, animated: true) | |
| } |
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
| class BooksCollectionViewController: UIViewController { | |
| @IBOutlet var collectionView: UICollectionView! | |
| var booksCollectionInterfaceProvider: BooksCollectionInterfaceProvider! | |
| var booksCollectionDataProvider: BaseBooksCollectionDataProvider! { | |
| didSet { | |
| title = booksCollectionDataProvider.title | |
| if booksCollectionDataProvider.datasource.isEmpty { | |
| booksCollectionDataProvider.loadData(paginationDelegate: self.paginationDelegate) |
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
| class BooksCollectionAllBooksDataProvider: BaseBooksCollectionDataProvider { | |
| override var title: String { | |
| return "All Books" | |
| } | |
| override var datasource: [ObjectId] { | |
| if let user = store.state.usersState.users[user] { | |
| return user.allBooks | |
| } | |
| return [] |