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 / UIColor+Extension.swift
Last active June 25, 2018 06:57
UIColor+Extension.swift
extension UIColor {
convenience public init(r: CGFloat, g: CGFloat, b: CGFloat) {
self.init(r: r, g: g, b: b, a: 1)
}
convenience public init(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) {
self.init(red: r/255, green: g/255, blue: b/255, alpha: a)
}
}
@yashthaker7
yashthaker7 / UIView+Extension.swift
Last active June 25, 2018 07:13
Apply gradient to view + Corner radius particular side to view + Anchors
import UIKit
extension UIView {
enum gradientType {
case vertical
case horizontal
case cross
}
@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 {
@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 / 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 / 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
//
// Extension+UIViewController.swift
//
// Created by Yash on 15/01/19.
// Copyright © 2019 Yash. All rights reserved.
//
import UIKit
import AVKit
//
// NetworkManager.swift
//
//
// Created by SOTSYS138 on 12/05/21.
//
import Alamofire
final class NetworkManager {
@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
//
// 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)