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
| // | |
| // ViewController.swift | |
| // RxToCombine | |
| // | |
| // Copyright © 2019 iamchiwon. All rights reserved. | |
| // | |
| import Combine | |
| import RxSwift | |
| import UIKit |
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
| fun <T> Observable<T>.retryInterval(intervals: List<Long>, filter: (Throwable) -> Boolean): Observable<T> { | |
| return this.retryWhen { throwable -> | |
| throwable | |
| .flatMap { e -> | |
| if (!filter(e)) return@flatMap Observable.error<Throwable>(e) | |
| return@flatMap Observable.just(e) | |
| } | |
| .zipWith(Observable.fromIterable(intervals)) { _, i -> i } | |
| .flatMap { Observable.timer(it, TimeUnit.MILLISECONDS, Schedulers.newThread()) } | |
| } |
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
| extension ObservableType { | |
| public func retryInterval(_ intervals: [RxTimeInterval], when f: @escaping (Error) -> Bool) -> Observable<Self.Element> { | |
| return retryWhen { error -> Observable<Int> in | |
| error.flatMap { e -> Observable<Void> in | |
| guard f(e) else { return .error(e) } | |
| return .just(()) | |
| } | |
| .zip(with: Observable<RxTimeInterval>.from(intervals)) { $1 } | |
| .flatMap { Observable<Int>.timer($0, scheduler: Schedulers.background) } | |
| } |
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 | |
| public extension Reactive where Base: UIViewController { | |
| public var viewDidLoad: ControlEvent<Void> { | |
| let source = self.methodInvoked(#selector(Base.viewDidLoad)).map { _ in } | |
| return ControlEvent(events: source) | |
| } | |
| public var viewWillAppear: ControlEvent<Bool> { |
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
| // MARK:- UIImagePickerController.rx | |
| import UIKit | |
| import RxSwift | |
| import RxCocoa | |
| // picker.rx.didFinishPickingMediaWithInfo | |
| // ~~~~~~ ~~ | |
| // Base Reactive |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>FILEHEADER</key> | |
| <string> | |
| // ======================================== | |
| // | |
| // Lorem Ipsum is simply dummy text of the | |
| // printing and typesetting industry. |
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
| #!/bin/bash | |
| # move project dir | |
| PROJECT_HOME=`pwd` | |
| echo "cd $PROJECT_HOME" > /tmp/tmp.sh | |
| # input command via dialog | |
| read -r -d '' applescriptCode <<'EOF' | |
| set commands to text returned of (display dialog "Shall Command" default answer "") | |
| return commands |
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
| #!/bin/bash | |
| open -a Terminal `pwd` |
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
| #!/bin/bash | |
| # move project dir | |
| PROJECT_HOME=`pwd` | |
| echo "cd $PROJECT_HOME" > /tmp/tmp.sh | |
| # pod init & update | |
| echo "pod update" >> /tmp/tmp.sh | |
| chmod +x /tmp/tmp.sh |
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
| #!/bin/bash | |
| # move project dir | |
| PROJECT_HOME=`pwd` | |
| echo "cd $PROJECT_HOME" > /tmp/tmp.sh | |
| # search .xcodeproj file and strip filename | |
| PROJECT_NAME="" | |
| for f in *.xcodeproj; do | |
| PROJECT_NAME="${f%.*}" |