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
import Photos | |
struct UnexpectedNilError: Error {} | |
extension PHImageManager { | |
func requestImage( | |
for asset: PHAsset, | |
targetSize: CGSize, | |
contentMode: PHImageContentMode, | |
options: PHImageRequestOptions? |
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
Task { [weak self] in | |
guard let self = self else { return } | |
let assets = self.assets | |
try await withThrowingTaskGroup(of: (Int, UIImage).self, | |
body: { group in | |
for (index, asset) in assets.enumerated() { | |
group.addTask { | |
return (index, try await self.fetchImage(for: asset.original)) | |
} |
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
class BuyCoordinator: Coordinator { | |
var childCoordinators = [Coordinator]() | |
weak var parentCoordinator: MainCoordinator? | |
var navigationController: UINavigationController | |
init(navigationController: UINavigationController) { | |
self.navigationController = navigationController | |
} | |