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 | |
| // Allows defining CodingKey from String | |
| struct DynamicCodingKey: CodingKey { | |
| var intValue: Int? | |
| var stringValue: String | |
| init?(intValue: Int) { | |
| assertionFailure("Not implemented") | |
| return nil |
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 | |
| extension DispatchQueue { | |
| func asyncConsumeInMainQueue<T>( | |
| work: @escaping () throws -> T, | |
| mainSuccess: @escaping (T) -> Void, | |
| mainError: @escaping (Error) -> Void) { | |
| async { | |
| do { | |
| let result = try work() |
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
| protocol FRCCollectionViewDelegate: class { | |
| func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell | |
| } | |
| class FRCCollectionViewDataSource<FetchRequestResult: NSFetchRequestResult>: NSObject, UICollectionViewDataSource, NSFetchedResultsControllerDelegate { | |
| let frc: NSFetchedResultsController<FetchRequestResult> | |
| weak var collectionView: UICollectionView? | |
| weak var delegate: FRCCollectionViewDelegate? | |