Skip to content

Instantly share code, notes, and snippets.

//
// 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)
@tcldr
tcldr / TimingFunction.swift
Last active April 5, 2025 06:46
For when you need the progress along an Apple Animation curve outside of CoreAnimation in a Swift 4.2 interface. Given a cubic Bezier timing curve defined by two control points, (or UIKit's `UICubicTimingParameters`), returns the progress along the curve at any given time. Includes a port of the WebKit implementation of UnitBezier which hopefull…
//
// TimingFunction.swift
//
// Created by tcldr on 04/11/2018.
// https://github.com/tcldr
// Copyright © 2018 tcldr.
//
// Permission is hereby granted, free of charge,
// to any person obtaining a copy of this software and
// associated documentation files (the "Software"), to
@AAlfare
AAlfare / String+Typography.swift
Created October 11, 2018 07:30
String + various spaces
extension String {
// NARROW NO-BREAK SPACE
// Unicode: U+202F, UTF-8: E2 80 AF
static let narrowNoBreakSpace = "\u{202F}"
//MEDIUM MATHEMATICAL SPACE
//Unicode: U+205F, UTF-8: E2 81 9F
static let mediumMathematicalSpace = "\u{205F}"
//HAIR SPACE
@vhart
vhart / Swift4-ReadWriteDelete.swift
Last active November 8, 2022 16:15
File Handling from an Xcode Playground
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
func setUpDemo() {
let testContents = """
This is a test
Emojis follow:
🚀
@shaps80
shaps80 / AVPlayer+Scrubbing.swift
Last active April 29, 2025 23:50
Enables smooth frame-by-frame scrubbing (in both directions) – similar to Apple's applications.
public enum Direction {
case forward
case backward
}
internal var player: AVPlayer?
private var isSeekInProgress = false
private var chaseTime = kCMTimeZero
private var preferredFrameRate: Float = 23.98
@NikhilManapure
NikhilManapure / Gif.swift
Last active October 29, 2023 07:31
Create Gif from array of UIImages in Swift 3
import Foundation
import UIKit
import ImageIO
import MobileCoreServices
extension UIImage {
static func animatedGif(from images: [UIImage]) {
let fileProperties: CFDictionary = [kCGImagePropertyGIFDictionary as String: [kCGImagePropertyGIFLoopCount as String: 0]] as CFDictionary
let frameProperties: CFDictionary = [kCGImagePropertyGIFDictionary as String: [(kCGImagePropertyGIFDelayTime as String): 1.0]] as CFDictionary
@objc protocol Refreshable
{
/// The refresh control
var refreshControl: UIRefreshControl? { get set }
/// The table view
var tableView: UITableView! { get set }
/// the function to call when the user pulls down to refresh
@objc func handleRefresh(_ sender: Any);
@hfossli
hfossli / Display.swift
Last active July 13, 2020 16:22
Display mode
import UIKit
public enum DisplayType {
case unknown
case iphone4
case iphone5
case iphone6
case iphone6plus
static let iphone7 = iphone6
static let iphone7plus = iphone6plus