Skip to content

Instantly share code, notes, and snippets.

@warpling
warpling / CAMediaTimingFunction.swift
Last active June 14, 2022 11:15
Better CAMediaTimingFunctions
//
// CAMediaTimingFunction.swift
import UIKit
extension CAMediaTimingFunction {
static let linear = CAMediaTimingFunction(name: .linear)
static let easeOut = CAMediaTimingFunction(name: .easeOut)
@sundeepgupta
sundeepgupta / animated-ellipsis.swift
Created March 2, 2017 19:35
Swift Animating Ellipsis Loader
class LoadingLabel: UILabel {
var timer: Timer?
let states = [".", "..", "..."]
var currentState = 0
func start() {
stop(withText: "")
timer = Timer.scheduledTimer(timeInterval: 0.3, target: self, selector: #selector(update), userInfo: nil, repeats: true)
timer?.fire()