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
extension UIImage { | |
@available(iOS 15, *) | |
var thumbnail: UIImage? { | |
get async { | |
let size = CGSize(width: 80, height: 40) | |
return await self.byPreparingThumbnail(ofSize: size) | |
} | |
} | |
} | |
enum FetchError:Error{ |
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 UIKit | |
#if canImport(SwiftUI) && DEBUG | |
import SwiftUI | |
struct UIViewControllerPreview<ViewController: UIViewController>: UIViewControllerRepresentable { | |
let viewController: ViewController | |
init(_ builder: @escaping () -> ViewController) { | |
viewController = builder() | |
} |
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
// 'map', 'transform', 'select', or 'project' function. Iterate over a list, | |
// performing a function on each item, and collecting the new items. Each | |
// function takes an item as a first argument and returns a transformed item. | |
// You can pass additional arguments to the function too, which is a decent poor | |
// man's function composition. | |
// (I didn't call this f-map because the term 'map' is already used in Sass to | |
// denote a hash or dictionary.) | |
@function f-apply($func, $list, $args...) { | |
$new-list: (); | |
@each $item in $list { |