This file contains hidden or 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 RxCocoa | |
import RxSwift | |
import Foundation | |
class PrintManager { | |
private var printer: BRPtouchPrinter! | |
init(printerObj: Printer, type: PrinterConnectionType = .BLUETOOTH) { | |
setupPrinter(with: type, using: printerObj) | |
printer.setPrintInfo(printConfig()) |
This file contains hidden or 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 RxSwift | |
import RxCocoa | |
extension Reactive where Base: UITableView { | |
var nearBottom: Driver<Bool> { | |
func isNearBottomEdge(tableView: UITableView, edgeOffset: CGFloat = 20.0) -> Bool { | |
return tableView.contentOffset.y + tableView.frame.size.height + edgeOffset > tableView.contentSize.height | |
} |
This file contains hidden or 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
class EventViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
bindable() | |
} | |
private func bindable() { | |
searchbar.rx.text | |
.orEmpty |
This file contains hidden or 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
class EventViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
bindable() | |
} | |
private func bindable() { | |
searchbar.rx.text |
This file contains hidden or 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
private func bindAttendeePhoto() { | |
let attendeePhoto = viewModel.photo | |
.flatMap { image -> Observable<UIImage> in | |
self.printBadge() | |
return Observable.just(image!) | |
} | |
.observeOn(ConcurrentDispatchQueueScheduler(qos: .background)) | |
.flatMapLatest { image -> Observable<(UIImage, Bool)> in | |
let eventId = self.event.id | |
let fileSize = image.getFilesize() |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |