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
| // | |
| // CachedAsyncImage.swift | |
| // guTravel | |
| // | |
| // Created by GonzaloMR on 26/8/24. | |
| // | |
| import SwiftUI | |
| /// CachedAsyncImage creates a SwiftUI view that loads, caches and displays an image asynchronously, using AsyncImagePhase to split the view to be displayed depending on the state of the image. |
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 UIKit | |
| // Image downloader utility class. We are going to use the singleton instance to be able to download required images and store them into in-memory cache. | |
| final class ImageDownloader { | |
| static let shared = ImageDownloader() | |
| private var cachedImages: [String: UIImage] | |
| private var imagesDownloadTasks: [String: URLSessionDataTask] |
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
| ## How to hide API keys from github ## | |
| 1. If you have already pushed commits with sensitive data, follow this guide to remove the sensitive info while | |
| retaining your commits: https://help.github.com/articles/remove-sensitive-data/ | |
| 2. In the terminal, create a config.js file and open it up: | |
| touch config.js | |
| atom config.js |