Skip to content

Instantly share code, notes, and snippets.

View budidino's full-sized avatar

Dino Budimilić budidino

View GitHub Profile
@budidino
budidino / string-truncate.swift
Last active April 3, 2024 20:11 — forked from vicc/string-truncate.swift
String truncate extension for Swift 4
extension String {
/*
Truncates the string to the specified length number of characters and appends an optional trailing string if longer.
- Parameter length: Desired maximum lengths of a string
- Parameter trailing: A 'String' that will be appended after the truncation.
- Returns: 'String' object.
*/
func trunc(length: Int, trailing: String = "…") -> String {
return (self.count > length) ? self.prefix(length) + trailing : self
@budidino
budidino / gist:ffefdbd1a8a33607c54d495b6120850e
Created April 28, 2017 04:10 — forked from acj/TrimVideo.swift
Trim video using AVFoundation in Swift
//
// TrimVideo.swift
// VideoLab
//
// Created by Adam Jensen on 3/28/15.
// Copyright (c) 2015 Adam Jensen. All rights reserved.
//
import AVFoundation
import Foundation