This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
static func pointer(_ object: AnyObject?) -> String { | |
guard let object = object else { return "nil" } | |
let opaque: UnsafeMutableRawPointer = Unmanaged.passUnretained(object).toOpaque() | |
return String(describing: opaque) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension Array where Element: Any { | |
func sliced(sliceSize: Int) -> [[Element]] { | |
var result = [[Element]]() | |
guard count > 0 else { return result } | |
let slicesCount = Int(ceil(Double(count) / Double(sliceSize))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SnapKit | |
extension UIView { | |
// MARK: Blur | |
func addBlur() { | |
backgroundColor = .clear | |
let blurView = makeBlurView() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UITableView { | |
func indexPath(for cellNumber: Int) -> IndexPath { | |
// Returns indexPath of given ordered cell number for any section/rows configuration | |
var cellIndex = 0 | |
var sectionIndex = 0 | |
var rowIndex = 0 | |
while sectionIndex < numberOfSections, cellIndex < cellNumber - 1 { |