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 RxSwift | |
import RealmSwift | |
import RxRealm | |
class BaseRealmDatasource { | |
var kRealm: Realm { preconditionFailure("Subclass of BaseRealmDatasource must provide an instance of Realm!") } | |
func getAll<T: Object>(obj: T.Type) -> Observable<[T]> { | |
Observable.array(from: kRealm.objects(T.self)) |
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 RectangularDashedView: UIView { | |
@IBInspectable var viewCornerRadius: CGFloat = 0 { | |
didSet { | |
layer.cornerRadius = viewCornerRadius | |
layer.masksToBounds = viewCornerRadius > 0 | |
} | |
} |
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 | |
import SwiftUI | |
extension Color { | |
//MARK: - App Colors | |
static let primaryColor = Color.color("#008577") | |
//MARK: - Color from HexString | |
static func color(_ hex: String, alpha: CGFloat = 1.0) -> Color { Color(UIColor(hex, alpha)) } |
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 Loader: UIView { | |
static let shared = Loader() | |
private var viewTag = 1234567890 | |
public override init(frame: CGRect) { | |
super.init(frame: frame) | |
backgroundColor = progressBarColor.withAlphaComponent(0.1) | |
tag = viewTag |
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
typealias VoidAction = (() -> Void) | |
class UIViewTapGestureRecognizer: UITapGestureRecognizer { | |
var action: VoidAction? = nil | |
} | |
struct AnchoredConstraints { | |
var top, leading, bottom, trailing, width, height: NSLayoutConstraint? | |
} |
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
final class MockURLProtocol: URLProtocol { | |
static var data: Data? | |
static var error: Error? | |
static var urlResponse: URLResponse? | |
override class func canInit(with request: URLRequest) -> Bool { | |
true | |
} | |
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 | |
func generateHapticFeedback(style: UIImpactFeedbackGenerator.FeedbackStyle = .light) { | |
UIImpactFeedbackGenerator(style: style).impactOccurred() | |
} | |
var notchHeight: CGFloat { UIApplication.shared.statusBarFrame.height } | |
enum ToastType { | |
case success, error |