Skip to content

Instantly share code, notes, and snippets.

View vladimir-bebeshko's full-sized avatar

Vladimir Bebeshko vladimir-bebeshko

  • Zaporizhzhya, Ukraine
View GitHub Profile
@vladimir-bebeshko
vladimir-bebeshko / CAAnimationChain.swift
Last active December 11, 2018 09:13
Chain Core Animations
/// Core Animation doesn't support chaining of animations by default. The `CAAnimationChain` class adds this ability.
/// The `CAAnimationSet` struct holds animation set for one target, and `CAAnimationChain` accepts an array of
/// `CAAnimationSet`s to support multiple targets.
import Foundation
class CAAnimationChain: NSObject, CAAnimationDelegate {
private var animationSets: [CAAnimationSet]
private let completion: (() -> Void)?
@vladimir-bebeshko
vladimir-bebeshko / UIFont+BestFit.swift
Created December 8, 2018 12:02 — forked from joncardasis/UIFont+BestFit.swift
Swift Dynamic Font Size for Bounds
extension UIFont {
/**
Will return the best font conforming to the descriptor which will fit in the provided bounds.
*/
static func bestFittingFontSize(for text: String, in bounds: CGRect, fontDescriptor: UIFontDescriptor, additionalAttributes: [NSAttributedStringKey: Any]? = nil) -> CGFloat {
let constrainingDimension = min(bounds.width, bounds.height)
let properBounds = CGRect(origin: .zero, size: bounds.size)
var attributes = additionalAttributes ?? [:]
@vladimir-bebeshko
vladimir-bebeshko / Contents.swift
Last active December 1, 2018 17:21 — forked from morishin/1_playground.swift
Custom Shape View with Shadow
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
let container = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 200))
container.backgroundColor = .lightGray
class MyView: UIView {
@vladimir-bebeshko
vladimir-bebeshko / pre-commit-swiftlint.sh
Last active May 15, 2019 09:50 — forked from haruair/pre-commit-swiftlint.sh
Git Client-side pre-commit hook for SwiftLint
#!/bin/bash
#
# hook script for swiftlint. It will triggered when you make a commit.
#
#TODO: move this content to separate file ('lint'), add separate file for swiftformat ('format'), use them here in pre-commit
GUI=0
LINT_PATH_FOR_GUI="/usr/local/bin/swiftlint"