Skip to content

Instantly share code, notes, and snippets.

View yashthaker7's full-sized avatar
🎯
Focusing

Yash Thaker yashthaker7

🎯
Focusing
View GitHub Profile
@yashthaker7
yashthaker7 / mac-file-transfer-via-command-line.md
Created February 19, 2021 04:33 — forked from kwcto/mac-file-transfer-via-command-line.md
How to copy files / folders off a Mac from the command line (optionally using Single User Mode)
@yashthaker7
yashthaker7 / Extension+UIImageView.swift
Last active September 9, 2020 06:48
This extension is to get image's aspectFill frame
extension UIImageView {
var getImageAspectFillFrame: CGRect? {
guard let image = image, frame != .zero else { return nil }
let imageSize = image.size
if imageSize.width > imageSize.height { // landscape
return calcMaxWidth(imageSize, frame.size)
} else if imageSize.height > imageSize.width { // portrait
return calcMaxHeight(imageSize, frame.size)
//
// TYAudioVideoManager.swift
// Yash Thaker
//
// Created by Yash Thaker on 05/12/18.
// Copyright © 2018 Yash Thaker. All rights reserved.
//
/*
1) mergeVideos(videoUrls: [URL], exportUrl: URL, preset: String? = nil, progress: @escaping Progress, completion: @escaping Completion)
@yashthaker7
yashthaker7 / SwipeUpDownTransition.swift
Last active October 15, 2018 10:12
Custom transition using segue
//
// SwipeUpDownTransition.swift
// CustomTransition
//
// Created by Yash Thaker on 18/04/18.
// Copyright © 2018 YashThaker. All rights reserved.
//
import UIKit
//
// NetworkManager.swift
//
//
// Created by SOTSYS138 on 12/05/21.
//
import Alamofire
final class NetworkManager {
//
// Extension+UIViewController.swift
//
// Created by Yash on 15/01/19.
// Copyright © 2019 Yash. All rights reserved.
//
import UIKit
import AVKit
@yashthaker7
yashthaker7 / Service.swift
Last active May 29, 2020 17:11
generic function for api service
// Service.swift
// Generics
//
// Created by Yash Thaker on 25/05/20.
// Copyright © 2020 YashThaker. All rights reserved.
//
/*
// ------------- How to use -------------
Service.shared.fetchUnsplashPhotos { result in
@yashthaker7
yashthaker7 / GenericTableViewController.swift
Last active July 6, 2018 05:57
Generic TableView Controller
// GenericTableViewController.swift
// Generics
//
// Created by Yash Thaker on 01/07/18.
// Copyright © 2018 YashThaker. All rights reserved.
import UIKit
/*
// <---------- HERE IS HOW TO USE. ---------->
@yashthaker7
yashthaker7 / KeyboardObserver.swift
Last active May 30, 2022 12:10
Keyboard observer for your chat view to change y position.
// how to use
// call addKeyboardObserver() in viewWillAppear
// call removeKeyboardObserver() in viewDidDisappear to prevent memory leak
// override changeKeyboardFrame function in viewController
extension UIViewController {
func addKeyboardObserver() {
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
@yashthaker7
yashthaker7 / CachedImageView.swift
Last active August 2, 2018 06:13
Download image from url, cache & set to imageView
//
// CachedImageView.swift
//
// Created by Yash Thaker on 01/01/18.
// Copyright © 2018 YashThaker. All rights reserved.
//
import UIKit
open class CachedImageView: UIImageView {