I hereby claim:
- I am pimcoumans on github.
- I am pimcoumans (https://keybase.io/pimcoumans) on keybase.
- I have a public key whose fingerprint is B7D5 832A C1B7 A316 1B44 9C2D A614 9B6B D8D2 9B7C
To claim this, I am signing this object:
extension CATransaction { | |
/// Executes the provided `actions` closure wrapped in `CATransaction`. | |
/// Optionally adds all the specific properties to commit the transaction with | |
/// - Parameters: | |
/// - duration: Duration of transaction | |
/// - timingFunction: Specific timing function to use with transaction | |
/// - disableActions: Wether actual animation should happen during transaction | |
/// - actions: What to do while transaction is commited | |
/// - completion: Closure to be executed when transaction is completes | |
/// |
import Foundation | |
extension CFRunLoop { | |
static func performNext(work: @escaping () -> Void) { | |
CFRunLoopPerformBlock(CFRunLoopGetMain(), CFRunLoopMode.defaultMode.rawValue, work) | |
} | |
} |
import UIKit | |
/// Adds a `configure` method with a closure that is executed with `Self` as a parameter | |
protocol Configurable { } | |
extension Configurable { | |
/// Configures the instance with a closure that is executed with `Self` as a parameter | |
/// - Parameter configurer: Closure exectured immediately with `Self` as a parameter | |
/// - Parameter instance: Use this parameter to 'configure' the instance | |
func configure(with configurer: (_ instance: Self) -> Void) { |
// | |
// TimelineLayout.swift | |
// OKVideo | |
// | |
// Created by Pim Coumans on 12/11/2020. | |
// Copyright © 2020 pixelrock. All rights reserved. | |
// | |
import UIKit |
import UIKit | |
extension CACornerMask { | |
static let all: CACornerMask = [ | |
.layerMaxXMaxYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMinXMinYCorner | |
] | |
} | |
extension UIView { | |
func roundCorners(by radius: CGFloat, corners: CACornerMask = .all) { |
class LayerView<Layer: CALayer>: UIView { | |
override static var layerClass: AnyClass { | |
return Layer.self | |
} | |
var castedLayer: Layer { | |
return super.layer as! Layer | |
} | |
} |
import Foundation | |
// Based on example by Thomas Theunen: https://thomastheunen.eu/2017/07/04/diving-into-synology-quickconnect-and-creating-a-javascript-library/ | |
struct QuickConnect { | |
private static let endpointURL = URL(string: "https://global.quickconnect.to/Serv.php")! | |
enum Error: Swift.Error { | |
case noAddressFound |
// let targetSize = CGSize(width: 100, height: 100) // whatever you want | |
var transform = videoAssetTrack.preferredTransform | |
let naturalSize = videoAssetTrack.naturalSize | |
let videoSize = CGRect(origin: .zero, size: naturalSize).applying(videoAssetTrack.preferredTransform).size | |
let rotation = atan2(transform.b, transform.a) | |
let isRotated = rotation.remainder(dividingBy: .pi) > 0.01 | |
let offset = CGPoint.zero.applying(transform.inverted()) |
I hereby claim:
To claim this, I am signing this object: