Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Borek TheAdamBorek

View GitHub Profile
View ab_rxactionsheet_tests_9.swift
let buttonTaps = testScheduler.createHotObservable([next(100, ()), next(200, ())])
buttonTaps.bindTo(subject.chooseImageButtonPressed)
.disposed(by: rx_disposeBag)
View ab_rxactionsheet_tests_8.swift
func test_receiveImage_onButtonClick_version2() {
let testScheduler = TestScheduler(initialClock: 0)
}
View ab_rxactionsheet_tests_5.swift
var resultImage: UIImage!
subject.image.drive(onNext: { image in
resultImage = image
}).disposed(by: rx_disposeBag)
View ab_rxactionsheet_tests_7.swift
func test_receiveImage_onButtonClick() {
var resultImage: UIImage!
subject.image.drive(onNext: { image in
resultImage = image
}).disposed(by: rx_disposeBag)
buttonTap.onNext(())
XCTAssertEqual(resultImage, imageHavingMock.expectedImage)
}
View ab_rxactionsheet_tests_6.swift
buttonTap.onNext(())
XCTAssertEqual(resultImage, imageHavingMock.expectedImage)
View ab_rxactionsheet_tests_4.swift
let buttonTap = PublishSubject<Void>()
buttonTap.bindTo(subject.chooseImageButtonPressed)
.disposed(by: rx_disposeBag)
View ab_rxactionsheet_tests_2.swift
final class ViewModelTests: XCTestCase {
private var subject: AvatarViewModel!
var imageHavingMock: ImageHavingStub!
override func setUp() {
super.setUp()
rx_disposeBag = DisposeBag()
imageHavingMock = ImageHavingStub()
subject = AvatarViewModel(imageReceiver: imageHavingMock)
}
View RxActionSheet.swift
private var selectedOption: Observable<ImageSource> {
return Observable.create { [weak self] observer in
guard let `self` = self else {
observer.onCompleted()
return Disposables.create()
}
let actionSheet = self.prepareActionSheet(with: observer)
self.presenter?.present(actionSheet)
return Disposables.create {
@TheAdamBorek
TheAdamBorek / PostsListViewModel.swift
Last active Aug 21, 2016
Inject an generic struct
View PostsListViewModel.swift
//
// Created by Adam Borek on 17.06.2016.
//
import Foundation
import RxSwift
import RxCocoa
class PostsListViewModel {
typealias Index = Int
You can’t perform that action at this time.