Skip to content

Instantly share code, notes, and snippets.

Open source

Sourav Chandra sauravexodus

Open source
Block or report user

Report or block sauravexodus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View RxBlocking_toArray.swift
Stubber.register(self.authRepository.signIn) { _ in .just(.failure(error: SignInReactor.ErrorMessage.signInFailed.rawValue)) }
let disposeBag = DisposeBag()
Observable.of(.signIn(email: self.defaultEmail, password: self.defaultPassword))
.delay(1, scheduler: MainScheduler.instance)
.bind(to: self.signInReactor.action)
.disposed(by: disposeBag)
let states = try? self.signInReactor.state.skip(1).take(2).toBlocking(timeout: 5).toArray()
View RxBlocking.swift
let disposeBag = DisposeBag()
Observable.of(.signIn(email: self.invalidEmail, password: self.defaultPassword))
.delay(1, scheduler: MainScheduler.instance)
.bind(to: self.signInReactor.action)
.disposed(by: disposeBag)
guard let state = try? self.signInReactor.state.skip(1).take(1).toBlocking(timeout: 5).first(), let errorMessage = state?.errorMessage else {
fail("It should emit error state")
View eureka_swift_3:searchable_push_row.swift
import Eureka
open class _SearchablePushRow<T: Equatable, Cell: CellType> : TableSelectorRow<Cell, SearchableViewController<T>> where Cell: BaseCell, Cell: TypedCellType, Cell.Value == T, T: SearchableItem, T: CustomStringConvertible {
public required init(tag: String?) {
super.init(tag: tag)
onCreateControllerCallback = { [weak self] _ in
let controller = SearchableViewController<T>()
controller.searchPlaceholder = self?.searchPlaceholder
return controller
sauravexodus / RelativeDimensioningUsage.swift
Created Sep 14, 2017
Usage of Relative Dimensionsing
View RelativeDimensioningUsage.swift
// Creating CGRects for your UIView frame
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 200.dp, height: 40.dp))
//Creating constraints
imageView.leftAnchor.constaint(equalTo: view.leftAnchor, constant: 16.dp).isActive = true
//Using as a font size
myLabel.font = UIFont.systemFont(ofSize: 13.dp)
sauravexodus / CGFloat+extensions.swift
Created Sep 14, 2017
Relative Dimensioning in Swift Manual Layouts
View CGFloat+extensions.swift
extension CGFloat {
The relative dimension to the corresponding screen size.
let someView = UIView(frame: CGRect(x: 0, y: 0, width: 320.dp, height: 40.dp)
**Warning** Only works with size references from @1x mockups.
sauravexodus / HowToUse.swift
Created Aug 27, 2017
How to use RxNuke+Firebase
View HowToUse.swift
import RxSwift
import RxCocoa
import RxNuke
import Nuke
// UIImageView object
lazy var myImageView: UIImageView = {
let myImageView = UIImageView()
myImageView.contentMode = .scaleAspectFit
myImageView.translatesAutoresizingMasksIntoConstraints = false
sauravexodus / Nuke+Firebase.swift
Last active Aug 27, 2017
An extension to Nuke for progressive image loading. [Required CocoaPods - RxNuke, RxSwift, FirebaseStorage]
View Nuke+Firebase.swift
import RxNuke
import Nuke
import RxSwift
import Firebase
import RxCocoa
enum ImageVariants: String {
case high = "_high"
case med = "_med"
case low = "_low"
You can’t perform that action at this time.