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 | |
public enum Image: String { | |
private static let bundle = Bundle(for: ClassInImageBundle.self) | |
// Your images here: | |
case imageOne = "image-1" | |
case imageTwo = "image-2" | |
public var uiImage: UIImage { |
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
// https://gist.github.com/JARinteractive/96cbba8f35dcd10bbb77 | |
import UIKit | |
extension CGSize { | |
public func centered(in rect: CGRect) -> CGRect { | |
let centeredPoint = CGPoint(x: rect.minX + abs(rect.width - width) / 2, y: rect.minY + abs(rect.height - height) / 2) | |
let size = CGSize(width: min(self.width, rect.width), height: min(self.height, rect.height)) | |
let point = CGPoint(x: max(centeredPoint.x, rect.minX), y: max(centeredPoint.y, rect.minY)) | |
return CGRect(origin: point, size: size) |
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 RxSwift | |
import RxSugar | |
protocol GenericTableCell: NSObjectProtocol { | |
typealias Class = Self | |
typealias ValueType | |
func populate(value: ValueType) | |
} |
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
// https://gist.github.com/JARinteractive/7fb33b6b0043f365ddfd | |
import Foundation | |
import XCTest | |
@discardableResult | |
public func AssertEventuallyTrue(file: StaticString = #file, line: UInt = #line, _ checkSuccess: @autoclosure () -> Bool) -> Bool { | |
return AssertEventuallyTrue(10.0, file: file, line: line, checkSuccess) | |
} | |
@discardableResult |
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 | |
private func delegateClassName() -> String? { | |
guard NSClassFromString("XCTestCase") == nil else { return nil } | |
return NSStringFromClass(AppDelegate) | |
} | |
UIApplicationMain(Process.argc, Process.unsafeArgv, nil, delegateClassName()) |