This gist started Wednesday 29th August. We have until Friday 7th September to upgrade to Elm 0.19. This is a bunch of notes which I'm keeping track of to eventually turn into an article later on. Hope it helps your upgrade.
428 Elm files.
import android.arch.lifecycle.LiveData | |
import android.arch.lifecycle.MediatorLiveData | |
import android.arch.lifecycle.MutableLiveData | |
fun <X, Y> LiveData<X>.map(func: (X?) -> Y?): MutableLiveData<Y?> { | |
return MediatorLiveData<Y>().apply { | |
addSource(this@map) { x -> value = func(x) } | |
} | |
} |
import android.arch.lifecycle.LiveData | |
import android.content.Context | |
import android.hardware.Sensor | |
import android.hardware.SensorEvent | |
import android.hardware.SensorEventListener | |
import android.hardware.SensorManager | |
data class Orientation( | |
val azimuth: Float, | |
val pitch: Float, |
import RxSwift | |
import Action | |
enum SceneStateOutput { | |
case idle | |
case sendingNoRecipient | |
case sendingSomeRecipients(sendingList: [String: String]) | |
case sending | |
} |
import UIKit | |
import RxSwift | |
import RxCocoa | |
final class SceneCoordinator: SceneCoordinatorType { | |
fileprivate var window: UIWindow | |
var currentViewController: UIViewController | |
required init(window: UIWindow) { |
import RxSwift // Version 3.2.0 | |
import RxCocoa // Version 3.2.0 | |
func keyboardHeight() -> Observable<CGFloat> { | |
return Observable | |
.from([ | |
NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillShow) | |
.map { notification -> CGFloat in | |
(notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0 | |
}, |
final class SayHelloViewModel: ViewModelType { | |
let input: Input | |
let output: Output | |
struct Input { | |
let name: AnyObserver<String> | |
let validate: AnyObserver<Void> | |
} | |
struct Output { |
/// Every view interacting with a `SayHelloViewModel` instance can conform to this. | |
protocol SayHelloViewModelBindable { | |
var disposeBag: DisposeBag? { get } | |
func bind(to viewModel: SayHelloViewModel) | |
} | |
/// TableViewCells | |
final class TextFieldCell: UITableViewCell, SayHelloViewModelBindable { | |
@IBOutlet weak var nameTextField: UITextField! | |
var disposeBag: DisposeBag? |