Skip to content

Commit

Permalink
Merge pull request #5 from RxSwiftCommunity/develop/1.0
Browse files Browse the repository at this point in the history
Override methods
  • Loading branch information
lm2343635 authored Apr 30, 2020
2 parents 492d117 + 67623a5 commit 8dc0c00
Show file tree
Hide file tree
Showing 33 changed files with 208 additions and 210 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ Carthage/Build
# Swift Package Manager
.build
Package.resolved
.swiftpm
.swiftpm

# rxtree
.rxtree-version
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

34 changes: 17 additions & 17 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
PODS:
- Differentiator (4.0.1)
- Fakery (4.1.1)
- Reusable (4.1.0):
- Reusable/Storyboard (= 4.1.0)
- Reusable/View (= 4.1.0)
- Reusable/Storyboard (4.1.0)
- Reusable/View (4.1.0)
- Reusable (4.1.1):
- Reusable/Storyboard (= 4.1.1)
- Reusable/View (= 4.1.1)
- Reusable/Storyboard (4.1.1)
- Reusable/View (4.1.1)
- RxBinding (0.3.1):
- RxCocoa (~> 5)
- RxSwift (~> 5)
- RxCocoa (5.0.1):
- RxCocoa (5.1.1):
- RxRelay (~> 5)
- RxSwift (~> 5)
- RxController (0.10):
Expand All @@ -25,12 +25,12 @@ PODS:
- RxCocoa (~> 5)
- RxDataSources (~> 4)
- RxSwift (~> 5)
- RxFlow (2.7.0):
- RxCocoa (>= 5.0.0)
- RxSwift (>= 5.0.0)
- RxRelay (5.0.1):
- RxFlow (2.8.0):
- RxCocoa (>= 5.1.1)
- RxSwift (>= 5.1.1)
- RxRelay (5.1.1):
- RxSwift (~> 5)
- RxSwift (5.0.1)
- RxSwift (5.1.1)
- SnapKit (5.0.1)

DEPENDENCIES:
Expand Down Expand Up @@ -61,17 +61,17 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Differentiator: 886080237d9f87f322641dedbc5be257061b0602
Fakery: d3380c4aa1efe7631c0831d7e26aa9db4491f014
Reusable: 82be188f29d96dc5eff0db7b2393bcc08d2cdd5b
Reusable: 53a9acf5c536f229b31b5865782414b508252ddb
RxBinding: 58be2cf1311165489a66eacb4a3e33932d598a53
RxCocoa: e741b9749968e8a143e2b787f1dfbff2b63d0a5c
RxCocoa: 32065309a38d29b5b0db858819b5bf9ef038b601
RxController: c596ce5b2bc9ab933649690838d60118f0e4b110
RxDataSources: efee07fa4de48477eca0a4611e6d11e2da9c1114
RxDataSourcesSingleSection: 4394e57ae097f33e3845cf3a57bdf7826eca2d38
RxFlow: 605ef6364d7e937bea8f9507a1e99a431cdc2493
RxRelay: 89d54507f4fd4d969e6ec1d4bd7f3673640b4640
RxSwift: e2dc62b366a3adf6a0be44ba9f405efd4c94e0c4
RxFlow: 41c9d56e7611c6470d00febdfee08b63b0b018f8
RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9
RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178
SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb

PODFILE CHECKSUM: 0e048f42166325ac7ea57547d12ebbc2fc47fb5f

COCOAPODS: 1.8.4
COCOAPODS: 1.9.1
29 changes: 18 additions & 11 deletions Example/RxController/Controller/Child/FirstNameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
// RxController_Example
//
// Created by Meng Li on 2019/06/03.
// Copyright © 2019 CocoaPods. All rights reserved.
// Copyright © 2019 MuShare. All rights reserved.
//

import RxSwift

private struct Const {

struct title {
Expand Down Expand Up @@ -59,22 +61,27 @@ class FirstNameViewController: BaseViewController<FirstNameViewModel> {

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white

view.addSubview(titleLabel)
view.addSubview(firstNameLabel)
view.addSubview(lastNameLabel)
view.addSubview(updateButton)
createConstraints()

disposeBag ~ [
view.backgroundColor = .white
}

override func subviews() -> [UIView] {
return [
titleLabel,
firstNameLabel,
lastNameLabel,
updateButton
]
}

override func bind() -> [Disposable] {
return [
viewModel.firstName ~> firstNameLabel.rx.text,
viewModel.lastName ~> lastNameLabel.rx.text
]
}


private func createConstraints() {
override func createConstraints() {

titleLabel.snp.makeConstraints {
$0.left.equalToSuperview().offset(Const.title.marginLeft)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RxController_Example
//
// Created by Meng Li on 2019/06/03.
// Copyright © 2019 CocoaPods. All rights reserved.
// Copyright © 2019 MuShare. All rights reserved.
//

import Fakery
Expand Down
30 changes: 18 additions & 12 deletions Example/RxController/Controller/Child/InfoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
// RxController
//
// Created by Meng Li on 04/01/2019.
// Copyright (c) 2019 XFLAG. All rights reserved.
// Copyright (c) 2019 MuShare. All rights reserved.
//

import RxSwift

private struct Const {

struct nameTitle {
Expand Down Expand Up @@ -66,24 +68,28 @@ class InfoViewController: BaseViewController<InfoViewModel> {
super.viewDidLoad()
view.backgroundColor = .white

view.addSubview(nameTitleLabel)
view.addSubview(numberTitleLabel)
view.addSubview(updateButton)
view.addSubview(nameView)
view.addSubview(numberView)

addChild(nameViewController, to: nameView)
addChild(numberViewController, to: numberView)

createConstraints()

disposeBag ~ [
}

override func subviews() -> [UIView] {
return [
nameTitleLabel,
numberTitleLabel,
updateButton,
nameView,
numberView
]
}

override func bind() -> [Disposable] {
return [
viewModel.name ~> nameTitleLabel.rx.text,
viewModel.number ~> numberTitleLabel.rx.text
]
}

private func createConstraints() {
override func createConstraints() {

nameTitleLabel.snp.makeConstraints {
$0.left.equalToSuperview().offset(Const.nameTitle.marginLeft)
Expand Down
2 changes: 1 addition & 1 deletion Example/RxController/Controller/Child/InfoViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RxController_Example
//
// Created by Meng Li on 2019/04/09.
// Copyright © 2019 XFLAG. All rights reserved.
// Copyright © 2019 MuShare. All rights reserved.
//

import RxSwift
Expand Down
28 changes: 18 additions & 10 deletions Example/RxController/Controller/Child/LastNameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
// RxController_Example
//
// Created by Meng Li on 2019/06/03.
// Copyright © 2019 CocoaPods. All rights reserved.
// Copyright © 2019 MuShare. All rights reserved.
//

import RxSwift

private struct Const {

struct title {
Expand Down Expand Up @@ -59,21 +61,27 @@ class LastNameViewController: BaseViewController<LastNameViewModel> {

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white

view.addSubview(titleLabel)
view.addSubview(firstNameLabel)
view.addSubview(lastNameLabel)
view.addSubview(updateButton)
createConstraints()

disposeBag ~ [
view.backgroundColor = .white
}

override func subviews() -> [UIView] {
return [
titleLabel,
firstNameLabel,
lastNameLabel,
updateButton
]
}

override func bind() -> [Disposable] {
return [
viewModel.firstName ~> firstNameLabel.rx.text,
viewModel.lastName ~> lastNameLabel.rx.text
]
}

private func createConstraints() {
override func createConstraints() {

titleLabel.snp.makeConstraints {
$0.left.equalToSuperview().offset(Const.title.marginLeft)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RxController_Example
//
// Created by Meng Li on 2019/06/03.
// Copyright © 2019 CocoaPods. All rights reserved.
// Copyright © 2019 MuShare. All rights reserved.
//

import Fakery
Expand Down
40 changes: 23 additions & 17 deletions Example/RxController/Controller/Child/NameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
// RxController_Example
//
// Created by Meng Li on 2019/04/16.
// Copyright © 2019 XFLAG. All rights reserved.
// Copyright © 2019 MuShare. All rights reserved.
//

import RxSwift

private struct Const {
struct title {
static let marginLeft = 10
Expand Down Expand Up @@ -78,32 +80,36 @@ class NameViewController: BaseViewController<NameViewModel> {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white

view.addSubview(titleLabel)
view.addSubview(nameLabel)
view.addSubview(numberLabel)
view.addSubview(updateButton)
view.addSubview(firstNameView)
view.addSubview(lastNameView)

addChild(firstNameViewController, to: firstNameView)
addChild(lastNameViewController, to: lastNameView)

createConstraints()

disposeBag ~ [
viewModel.name ~> nameLabel.rx.text,
viewModel.number ~> numberLabel.rx.text
]
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

viewModel.updateName()
}

override func subviews() -> [UIView] {
return [
titleLabel,
nameLabel,
numberLabel,
updateButton,
firstNameView,
lastNameView
]
}

private func createConstraints() {
override func bind() -> [Disposable] {
return [
viewModel.name ~> nameLabel.rx.text,
viewModel.number ~> numberLabel.rx.text
]
}

override func createConstraints() {

titleLabel.snp.makeConstraints {
$0.left.equalToSuperview().offset(Const.title.marginLeft)
Expand Down Expand Up @@ -135,7 +141,7 @@ class NameViewController: BaseViewController<NameViewModel> {
lastNameView.snp.makeConstraints {
$0.height.equalTo(Const.lastName.height)
$0.left.right.equalToSuperview()
$0.top.equalTo(firstNameViewController.view.snp.bottom).offset(Const.lastName.marginTop)
$0.top.equalTo(firstNameView.snp.bottom).offset(Const.lastName.marginTop)
}

}
Expand Down
2 changes: 1 addition & 1 deletion Example/RxController/Controller/Child/NameViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RxController_Example
//
// Created by Meng Li on 2019/04/16.
// Copyright © 2019 XFLAG. All rights reserved.
// Copyright © 2019 MuShare. All rights reserved.
//

import Fakery
Expand Down
Loading

0 comments on commit 8dc0c00

Please sign in to comment.