Skip to content

Instantly share code, notes, and snippets.

@sohilmemon
sohilmemon / ScreenRecorder
Last active December 19, 2019 04:14
Screen Recorder Using ReplayKit (Swift 4.0+) - Drag & Drop Helper
//
// ScreenRecorder.swift
// Sohil R. Memon
//
// Created by Sohil R. Memon
// Copyright © 2018 Sohil R. Memon. All rights reserved.
//
import Foundation
import ReplayKit
@fjcaetano
fjcaetano / DispatchQueue+DebounceThrottle.swift
Last active September 23, 2021 07:25
Debounce + Throttle
import Dispatch
private var throttleWorkItems = [AnyHashable: DispatchWorkItem]()
private var lastDebounceCallTimes = [AnyHashable: DispatchTime]()
private let nilContext: AnyHashable = arc4random()
public extension DispatchQueue {
/**
- parameters:
- deadline: The timespan to delay a closure execution
@0111b
0111b / UIView+awakeAfter.swift
Created December 4, 2017 04:18
UIView awake after
import UIKit
extension UIView {
open override func awakeAfter(using aDecoder: NSCoder) -> Any? {
let viewType = type(of: self)
let nibName = String(describing: Mirror(reflecting: self).subjectType)
let bundle = Bundle.main //Bundle(for: viewType)
//Prevents infinite loop from loadNibNamed internally-calling awakeAfterUsingCoder. Is false when called from storyboard, true when