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 | |
// 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 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
// | |
// MovieCell.swift | |
// | |
import UIKit | |
final class MovieCell: UITableViewCell { | |
let posterImageView = UIImageView(frame: .zero) |
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
// | |
// ScrollViewController.swift | |
// Test | |
// | |
// Created by Jayesh Kawli on 19/04/2023. | |
// | |
// custom scroll view stack view in Swift | |
import Foundation |
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
// | |
// HorizontalScrollView.swift | |
// Test | |
// | |
// Created by Jayesh Kawli on 4/21/23. | |
// | |
import UIKit | |
class HorizontalScrollView : UIViewController { |
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 VerticalScrollView : UIViewController { | |
init() { | |
super.init(nibName: nil, bundle: nil) | |
} | |
required init?(coder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} |
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
// | |
// InfiniteLoadingScreen.swift | |
// Test | |
// | |
// Created by Jayesh Kawli on 1/12/23. | |
// | |
import SwiftUI | |
struct Employee: Identifiable, Equatable { |
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 Foundation | |
enum APIRouteDomain { | |
case userLoginManagement(APIRoute) | |
case accountInfoManagement(APIRoute) | |
case accountManagement(APIRoute) | |
var associatedApiRoute: APIRoute { | |
switch self { | |
case .userLoginManagement(let apiRoute), .accountInfoManagement(let apiRoute), .accountManagement(let apiRoute): |
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 SwiftUI | |
struct CustomViewDidLoad: View { | |
var body: some View { | |
VStack { | |
Text("Hello") | |
} | |
} |
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
// A protocol for mocking DispatchQueue instance | |
protocol DispatchQueueType { | |
func async(execute work: @escaping @convention(block) () -> Void) | |
} | |
// Confirming existing DispatchQueue to DispatchQueueType | |
extension DispatchQueue: DispatchQueueType { | |
func async(execute work: @escaping @convention(block) () -> Void) { | |
async(group: nil, qos: .unspecified, flags: [], execute: work) |
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
// An utility view extension | |
extension View { | |
@ViewBuilder | |
func `if`<Transform: View>(_ condition: Bool, transform: (Self) -> Transform) -> some View { | |
if condition { transform(self) } | |
else { self } | |
} | |
} |