Skip to content

Instantly share code, notes, and snippets.

View m3rkus's full-sized avatar

Anistratenko Roman m3rkus

  • Taganrog, Russian Federation
View GitHub Profile
@tcldr
tcldr / TimingFunction.swift
Last active March 21, 2023 07:24
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
@damienlaughton
damienlaughton / UIAccessorizedTextField.swift
Created March 28, 2018 15:16
UIAccessorizedTextField is an iOS friendly alternative to the drop down list
//
// UIAccessorizedTextField.swift
// AccessorizedTextField
//
// Created by Damien Laughton on 28/03/2018.
// 2018 Mobilology Limited. No rights reserved.
//
import Foundation
import UIKit
@JohnSundell
JohnSundell / simrecord
Created March 16, 2018 21:05
🎥 Script that lets you start a video recording from the iOS simulator with one command
#!/bin/bash
ITERATION=1
EXTENSION="mp4"
FILENAME="$HOME/Desktop/Simulator Recording.$EXTENSION"
while [ -e "$FILENAME" ]
do
ITERATION=$((ITERATION+1))
FILENAME="$HOME/Desktop/Simulator Recording $ITERATION.$EXTENSION"
@lattner
lattner / TaskConcurrencyManifesto.md
Last active April 18, 2024 09:44
Swift Concurrency Manifesto
@norsez
norsez / UIImage+Rotation.swift
Last active February 19, 2023 04:54
Rotate UIImage by radians in Swift 3
extension UIImage {
func image(withRotation radians: CGFloat) -> UIImage {
let cgImage = self.cgImage!
let LARGEST_SIZE = CGFloat(max(self.size.width, self.size.height))
let context = CGContext.init(data: nil, width:Int(LARGEST_SIZE), height:Int(LARGEST_SIZE), bitsPerComponent: cgImage.bitsPerComponent, bytesPerRow: 0, space: cgImage.colorSpace!, bitmapInfo: cgImage.bitmapInfo.rawValue)!
var drawRect = CGRect.zero
drawRect.size = self.size
let drawOrigin = CGPoint(x: (LARGEST_SIZE - self.size.width) * 0.5,y: (LARGEST_SIZE - self.size.height) * 0.5)
@brennanMKE
brennanMKE / DesignableButton.swift
Last active December 29, 2017 20:45
Designable Button made with Swift for live designing in Xcode Storyboards
import UIKit
enum DesignableButtonStyle: Int {
case Regular = 0
case Light
case Dark
case Fancy
case Alert
}
@IanKeen
IanKeen / IKScrollView.swift
Last active November 18, 2021 16:34
A UIScrollView subclass that allows you to use scrollviews and autolayout without the drama...
enum SizeMatching {
case Width, Height, Both, None
}
class IKScrollView: UIScrollView {
//MARK: - Outlets
@IBOutlet private var contentView: UIView?
//MARK: - Properties
@IBInspectable var sizeMatching = SizeMatching.Width