View ScreenSizes.swift
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
enum ScreenSizes { | |
static let threePointFiveInchesPhoneFrame = CGRect(x: 0, y: 0, width: 320, height: 480) | |
static let fourInchesPhoneFrame = CGRect(x: 0, y: 0, width: 320, height: 568) | |
static let fourPointSevenInchesPhoneFrame = CGRect(x: 0, y: 0, width: 375, height: 667) | |
static let iPadPortrait = CGRect(x: 0, y: 0, width: 768, height: 1024) | |
static let iPadLandscape = CGRect(x: 0, y: 0, width: 1024, height: 768) | |
} |
View TwoWayBinding.swift
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 | |
import RxSwift | |
import RxSwiftExt | |
import RxCocoa | |
extension Variable { | |
func bidirectionalBind(with controlProperty: ControlProperty<Element>) -> Disposable { | |
let bindingToControl = self | |
.asDriver() | |
.drive(controlProperty) |
View ab_rxactionsheet_tests_16.swift
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
func test_asksManagerForLastPhotoTaken_version2() { | |
let expectedImage = UIImage() | |
photosManagerMock.expectedImage = expectedImage | |
expect(subject.lastPhotoTaken) == expectedImage | |
} |
View ab_rxactionsheet_tests_15.swift
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
func test_asksManagerForLastPhotoTaken_version2() { | |
let expectedImage = UIImage() | |
photosManagerMock.expectedImage = expectedImage | |
let image = try! subject.lastPhotoTaken.toBlocking().first()! | |
XCTAssertEqual(image, expectedImage) | |
} |
View ab_rxactionsheet_tests_14.swift
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
override func setUp() { | |
//... | |
driveOnScheduler(testScheduler) { | |
subject = AvatarViewModel(imageReceiver: imageHavingMock) | |
} | |
} |
View ab_rxactionsheet_tests_13.swift
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
func test_receiveImage_onButtonClick2() { | |
simulateTaps(at: 100, 200) | |
let observer = testScheduler.createObserver(UIImage.self) | |
subject.image.drive(observer) | |
.disposed(by: rx_disposeBag) | |
testScheduler.start() | |
XCTAssertEqual(observer.events, [next(100, imageHavingMock.expectedImage), next(200, imageHavingMock.expectedImage)]) | |
} |
View ab_rxactionsheet_tests_12.swift
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
func test_receiveImage_onButtonClick_version2() { | |
let buttonTaps = testScheduler.createHotObservable([next(100, ()), next(200, ())]) | |
buttonTaps.bindTo(subject.chooseImageButtonPressed) | |
.disposed(by: rx_disposeBag) | |
let observer = testScheduler.createObserver(UIImage.self) | |
self.subject.image.drive(observer) | |
.disposed(by: self.rx_disposeBag) | |
testScheduler.start() | |
View ab_rxactionsheet_tests_11.swift
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
testScheduler.start() | |
XCTAssertEqual(observer.events, [next(100, imageHavingMock.expectedImage), next(200, imageHavingMock.expectedImage)]) |
View ab_rxactionsheet_tests_10.swift
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
let observer = testScheduler.createObserver(UIImage.self) | |
subject.image.drive(observer) | |
.disposed(by: rx_disposeBag) |
View ab_rxactionsheet_tests_9.swift
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
let buttonTaps = testScheduler.createHotObservable([next(100, ()), next(200, ())]) | |
buttonTaps.bindTo(subject.chooseImageButtonPressed) | |
.disposed(by: rx_disposeBag) |
NewerOlder