Skip to content

Instantly share code, notes, and snippets.

View ilia3546's full-sized avatar
🧙

Ilya Kharlamov ilia3546

🧙
View GitHub Profile
@ilia3546
ilia3546 / UIColor+Blend.swift
Created January 19, 2023 11:32
Blending two UIColor's. Swift implementation of JordanDelcros's JS algorithm https://gist.github.com/JordanDelcros/518396da1c13f75ee057
import UIKit
public extension UIColor {
/**
Blend current color with some overlay
Source - [JordanDelcros's JS algorithm](https://gist.github.com/JordanDelcros/518396da1c13f75ee057)
*/
func blended(with overlay: UIColor) -> UIColor {
@ilia3546
ilia3546 / UIStatusBarManager+ScrollToTop.swift
Last active December 22, 2022 08:55
Tap simulation on UIStatusBar for manual scrolling to top. Dangerous - Private API!
import UIKit
public extension UIStatusBarManager {
func scrollToTop() {
let selector = NSSelectorFromString("handleTapAction:")
let action = UIStatusBarTapAction()
perform(selector, with: action)
}
}
@policante
policante / BaseNavigationController.swift
Created February 20, 2019 20:40
UINavigationController swipe back like Facebook, Instagram
class BaseNavigationController: UINavigationController, UINavigationControllerDelegate {
var interactivePopTransition: UIPercentDrivenInteractiveTransition!
override func viewDidLoad() {
self.delegate = self
}
func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
addPanGesture(viewController)
@goocarlos
goocarlos / folderSize.swift
Created January 14, 2015 14:30
folderSize Swift Implementation
class func folderSize(folderPath:String) -> UInt{
// @see http://stackoverflow.com/questions/2188469/calculate-the-size-of-a-folder
let filesArray:[String] = NSFileManager.defaultManager().subpathsOfDirectoryAtPath(folderPath, error: nil)! as [String]
var fileSize:UInt = 0
for fileName in filesArray{
let filePath = folderPath.stringByAppendingPathComponent(fileName)
let fileDictionary:NSDictionary = NSFileManager.defaultManager().attributesOfItemAtPath(filePath, error: nil)!