This file contains 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 { | |
func matches(_ regex: String) -> Bool { | |
return self.range(of: regex, | |
options: .regularExpression, | |
range: nil, | |
locale: nil) != nil | |
} | |
} |
This file contains 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 UIView { | |
func colorOfPoint(point: CGPoint) -> UIColor { | |
let colorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB() | |
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue) | |
var pixelData: [UInt8] = [0, 0, 0, 0] | |
guard let context = CGContext(data: &pixelData, | |
width: 1, | |
height: 1, | |
bitsPerComponent: 8, | |
bytesPerRow: 4, |
This file contains 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 UIColor { | |
convenience init(hexString: String, alpha: CGFloat = 1) { | |
self.init(hex: UInt(hexString.dropFirst(), | |
radix: 16) ?? 0, alpha: alpha) | |
} | |
convenience init(hex: UInt, alpha: CGFloat = 1) { | |
self.init(red: .init((hex & 0xff0000) >> 16) / 255, | |
green: .init((hex & 0xff00 ) >> 8) / 255, |
This file contains 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
ios: | |
xcodebuild archive \ | |
-scheme TweakFramework \ | |
-configuration Release \ | |
-destination 'generic/platform=iOS' \ | |
-archivePath './build/TweakFramework.framework-iphoneos.xcarchive' \ | |
SKIP_INSTALL=NO \ | |
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES | |
simulator: |
This file contains 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 | |
protocol Reusable: class { | |
static var reuseIdentifier: String { get } | |
} | |
extension UICollectionViewCell: Reusable { | |
static var reuseIdentifier: String { | |
return self.description() |
This file contains 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 | |
class SwipeableCell: UICollectionViewCell, UIGestureRecognizerDelegate { | |
var maxSwipeOffset = CGFloat(200) | |
private var pan: UIPanGestureRecognizer! | |
override init(frame: CGRect) { | |
super.init(frame: frame) |
NewerOlder