Skip to content

Instantly share code, notes, and snippets.

import Dispatch
private var throttleItems = Atomic([AnyHashable: ThrottleItem]())
private var debounceItems = Atomic([AnyHashable: DebounceItem]())
extension DispatchQueue {
/// First action is executed, then other actions will be performed at most once per specified interval.
/// - Note:
/// Only the first call's `interval` is taken into account and updated every interval.
@yusuke024
yusuke024 / ViewController.swift
Created November 16, 2018 03:15
Recording video with AVAssetWriter
import UIKit
import AVFoundation
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
switch AVCaptureDevice.authorizationStatus(for: .video) {
case .notDetermined: