View RequestHandlerTests.swift
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
// JSONDataReader.swift | |
import XCTest | |
final class JSONDataReader { | |
static func getDataFromJSONFile(with name: String) -> Data? { | |
guard let pathString = Bundle(for: self).path(forResource: name, ofType: "json") else { | |
XCTFail("Mock JSON file \(name).json not found") | |
return nil | |
} |
View RoundedCornerBorderAndShadowStyles.swift
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 } | |
} | |
} |
View MockDispatchQueue.swift
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) |
View CustomViewDidLoad.swift
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") | |
} | |
} |
View RequestHandler.swift
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): |
View InfiniteLoadingScreen.swift
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 { |
View VerticalScrollView.swift
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") | |
} |
View HorizontalScrollView.swift
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 { |
View StackViewScrollView.swift
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 |
View .zshrc
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
function parse_git_branch() { | |
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p' | |
} | |
COLOR_DEF=$'\e[0m' | |
COLOR_USR=$'\e[38;5;243m' | |
COLOR_DIR=$'\e[38;5;197m' | |
COLOR_GIT=$'\e[38;5;39m' | |
setopt PROMPT_SUBST |
NewerOlder