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
public extension MoyaProvider { | |
public func request(_ target: Target, | |
callbackQueue: DispatchQueue? = nil, | |
progress: ProgressBlock? = nil) -> Promise<Moya.Response> { | |
return Promise { [weak self] fulfill, reject in | |
self?.request( | |
target, | |
callbackQueue: callbackQueue, | |
progress: progress, | |
completion: self?.completion(for: fulfill, reject: reject) ?? {_ in } |
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 Foundation | |
fileprivate extension String { | |
var sourceFileName: String { | |
let fileName = self.components(separatedBy: "/").last?.split(separator: ".").first ?? "" | |
return String(fileName) | |
} | |
} | |
public class Logger { |
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 | |
open class KeyboardManager: NSObject { | |
public enum KeyboardEvent { | |
case willShow | |
case didShow | |
case willHide | |
case didHide | |
case willChangeFrame | |
case didChangeFrame |
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 | |
@IBDesignable | |
public class View: UIView { | |
// MARK: - Layer stuff | |
@IBInspectable | |
public var cornerRadius: CGFloat { | |
get { | |
return layer.cornerRadius | |
} |
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 | |
@IBDesignable | |
class ImageView: UIImageView { | |
// MARK: - Layer stuff | |
@IBInspectable | |
var cornerRadius: CGFloat { | |
get { | |
return layer.cornerRadius |
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 | |
/* | |
Usage: | |
1. Create new xib file. | |
2. Create new swift file containg class subclassed from CustomXibView. | |
3. In xib set recently created class name as File's owner. | |
*/ |
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 | |
@IBDesignable | |
class SteppedSlider: UISlider { | |
@IBInspectable var stepSize: Int = 1 | |
@IBInspectable var normalThumbImage: UIImage? { | |
get { | |
return thumbImage(for: .normal) | |
} |
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 UIBezierPath { | |
/// Makes a bezier path which can be used for a rounded polygon | |
/// layer | |
/// | |
/// - Parameters: | |
/// - rect: uiview rect bounds | |
/// - lineWidth: width border line | |
/// - sides: number of polygon's sides |
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 SelfSizedTableView: UITableView { | |
lazy var heightConstraint: NSLayoutConstraint = { | |
let constraint = NSLayoutConstraint(item: self, attribute: .height, relatedBy: NSLayoutRelation.equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: bounds.height) | |
return constraint | |
}() | |
override init(frame: CGRect, style: UITableViewStyle) { | |
super.init(frame: frame, style: style) |
OlderNewer