Skip to content

Commit

Permalink
Merge pull request sergdort#68 from JustinDSN/feature/update-pods
Browse files Browse the repository at this point in the history
Update Pods (RxSwift 5.0)
  • Loading branch information
sergdort authored May 16, 2019
2 parents 418f1aa + 7fee678 commit 3bcf782
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 140 deletions.
69 changes: 21 additions & 48 deletions CleanArchitectureRxSwift.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ final class EditPostViewController: UIViewController {
.forEach({$0.disposed(by: disposeBag)})
}

var postBinding: UIBindingObserver<EditPostViewController, Post> {
return UIBindingObserver(UIElement: self, binding: { (vc, post) in
var postBinding: Binder<Post> {
return Binder(self, binding: { (vc, post) in
vc.titleTextField.text = post.title
vc.detailsTextView.text = post.body
vc.title = post.title
})
}

var errorBinding: UIBindingObserver<EditPostViewController, Error> {
return UIBindingObserver(UIElement: self, binding: { (vc, _) in
var errorBinding: Binder<Error> {
return Binder(self, binding: { (vc, _) in
let alert = UIAlertController(title: "Save Error",
message: "Something went wrong",
preferredStyle: .alert)
Expand All @@ -78,8 +78,8 @@ final class EditPostViewController: UIViewController {


extension Reactive where Base: UITextView {
var isEditable: UIBindingObserver<UITextView, Bool> {
return UIBindingObserver(UIElement: self.base, binding: { (textView, isEditable) in
var isEditable: Binder<Bool> {
return Binder(self.base, binding: { (textView, isEditable) in
textView.isEditable = isEditable
})
}
Expand Down
8 changes: 4 additions & 4 deletions CleanArchitectureRxSwift/Utility/ActivityIndicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import RxSwift
import RxCocoa

public class ActivityIndicator: SharedSequenceConvertibleType {
public typealias E = Bool
public typealias Element = Bool
public typealias SharingStrategy = DriverSharingStrategy

private let _lock = NSRecursiveLock()
Expand All @@ -15,7 +15,7 @@ public class ActivityIndicator: SharedSequenceConvertibleType {
.distinctUntilChanged()
}

fileprivate func trackActivityOfObservable<O: ObservableConvertibleType>(_ source: O) -> Observable<O.E> {
fileprivate func trackActivityOfObservable<O: ObservableConvertibleType>(_ source: O) -> Observable<O.Element> {
return source.asObservable()
.do(onNext: { _ in
self.sendStopLoading()
Expand All @@ -38,13 +38,13 @@ public class ActivityIndicator: SharedSequenceConvertibleType {
_lock.unlock()
}

public func asSharedSequence() -> SharedSequence<SharingStrategy, E> {
public func asSharedSequence() -> SharedSequence<SharingStrategy, Element> {
return _loading
}
}

extension ObservableConvertibleType {
public func trackActivity(_ activityIndicator: ActivityIndicator) -> Observable<E> {
public func trackActivity(_ activityIndicator: ActivityIndicator) -> Observable<Element> {
return activityIndicator.trackActivityOfObservable(self)
}
}
4 changes: 2 additions & 2 deletions CleanArchitectureRxSwift/Utility/ErrorTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ErrorTracker: SharedSequenceConvertibleType {
typealias SharingStrategy = DriverSharingStrategy
private let _subject = PublishSubject<Error>()

func trackError<O: ObservableConvertibleType>(from source: O) -> Observable<O.E> {
func trackError<O: ObservableConvertibleType>(from source: O) -> Observable<O.Element> {
return source.asObservable().do(onError: onError)
}

Expand All @@ -34,7 +34,7 @@ final class ErrorTracker: SharedSequenceConvertibleType {
}

extension ObservableConvertibleType {
func trackError(_ errorTracker: ErrorTracker) -> Observable<E> {
func trackError(_ errorTracker: ErrorTracker) -> Observable<Element> {
return errorTracker.trackError(from: self)
}
}
6 changes: 3 additions & 3 deletions CleanArchitectureRxSwift/Utility/Observable+Ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import RxSwift
import RxCocoa

extension ObservableType where E == Bool {
extension ObservableType where Element == Bool {
/// Boolean not operator
public func not() -> Observable<Bool> {
return self.map(!)
Expand All @@ -18,13 +18,13 @@ extension SharedSequenceConvertibleType {

extension ObservableType {

func catchErrorJustComplete() -> Observable<E> {
func catchErrorJustComplete() -> Observable<Element> {
return catchError { _ in
return Observable.empty()
}
}

func asDriverOnErrorJustComplete() -> Driver<E> {
func asDriverOnErrorJustComplete() -> Driver<Element> {
return asDriver { error in
return Driver.empty()
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@testable import CleanArchitectureRxSwift
import RxSwift
import Domain

class PostsUseCaseMock: Domain.PostsUseCase {
var posts_ReturnValue: Observable<[Post]> = Observable.just([])
var posts_Called = false
var save_ReturnValue: Observable<Void> = Observable.just(())
var save_Called = false
var delete_ReturnValue: Observable<Void> = Observable.just(())
var delete_Called = false

func posts() -> Observable<[Post]> {
posts_Called = true
return posts_ReturnValue
}

func save(post: Post) -> Observable<Void> {
save_Called = true
return save_ReturnValue
}

func delete(post: Post) -> Observable<Void> {
delete_Called = true
return delete_ReturnValue
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ enum TestError: Error {

class PostsViewModelTests: XCTestCase {

var allPostUseCase: AllPostsUseCaseMock!
var allPostUseCase: PostsUseCaseMock!
var postsNavigator: PostNavigatorMock!
var viewModel: PostsViewModel!

Expand All @@ -20,7 +20,7 @@ class PostsViewModelTests: XCTestCase {
override func setUp() {
super.setUp()

allPostUseCase = AllPostsUseCaseMock()
allPostUseCase = PostsUseCaseMock()
postsNavigator = PostNavigatorMock()

viewModel = PostsViewModel(useCase: allPostUseCase,
Expand All @@ -35,7 +35,7 @@ class PostsViewModelTests: XCTestCase {

// act
output.posts.drive().disposed(by: disposeBag)
trigger.onNext()
trigger.onNext(())

// assert
XCTAssert(allPostUseCase.posts_Called)
Expand All @@ -55,7 +55,7 @@ class PostsViewModelTests: XCTestCase {
onSubscribe: { actualFetching.append(true) })
.drive()
.disposed(by: disposeBag)
trigger.onNext()
trigger.onNext(())

// assert
XCTAssertEqual(actualFetching, expectedFetching)
Expand All @@ -70,7 +70,7 @@ class PostsViewModelTests: XCTestCase {
// act
output.posts.drive().disposed(by: disposeBag)
output.error.drive().disposed(by: disposeBag)
trigger.onNext()
trigger.onNext(())
let error = try! output.error.toBlocking().first()

// assert
Expand All @@ -85,7 +85,7 @@ class PostsViewModelTests: XCTestCase {

// act
output.posts.drive().disposed(by: disposeBag)
trigger.onNext()
trigger.onNext(())
let posts = try! output.posts.toBlocking().first()!

// assert
Expand Down Expand Up @@ -119,13 +119,13 @@ class PostsViewModelTests: XCTestCase {
// act
output.posts.drive().disposed(by: disposeBag)
output.createPost.drive().disposed(by: disposeBag)
create.onNext()
create.onNext(())

// assert
XCTAssertTrue(postsNavigator.toCreatePost_Called)
}

private func createInput(trigger: Observable<Void> = Observable.just(),
private func createInput(trigger: Observable<Void> = Observable.just(()),
createPostTrigger: Observable<Void> = Observable.never(),
selection: Observable<IndexPath> = Observable.never())
-> PostsViewModel.Input {
Expand All @@ -137,8 +137,8 @@ class PostsViewModelTests: XCTestCase {

private func createPosts() -> [Post] {
return [
Post(body: "body 1", title: "title 1", uid: "uid 1", userId: "userId 1"),
Post(body: "body 2", title: "title 2", uid: "uid 2", userId: "userId 2")
Post(body: "body 1", title: "title 1", uid: "uid 1", userId: "userId 1", createdAt: "created at 1"),
Post(body: "body 2", title: "title 2", uid: "uid 2", userId: "userId 2", createdAt: "created at 2")
]
}
}
2 changes: 1 addition & 1 deletion NetworkPlatform/UseCases/PostsUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class PostsUseCase<Cache>: Domain.PostsUseCase where Cache: AbstractCache,
}

struct MapFromNever: Error {}
extension ObservableType where E == Never {
extension ObservableType where Element == Never {
func map<T>(to: T.Type) -> Observable<T> {
return self.flatMap { _ in
return Observable<T>.error(MapFromNever())
Expand Down
11 changes: 6 additions & 5 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
inhibit_all_warnings!

def rx_swift
pod 'RxSwift', '~> 4.0'
pod 'RxSwift', '~> 5.0'
end

def rx_cocoa
pod 'RxCocoa', '~> 4.0'
pod 'RxCocoa', '~> 5.0'
end

def test_pods
Expand Down Expand Up @@ -71,10 +72,10 @@ target 'RealmPlatform' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
pod 'RxRealm', '~> 0.7.1'
pod 'RxRealm', '~> 1.0.0'
pod 'QueryKit'
pod 'RealmSwift', '~> 3.10'
pod 'Realm', '~> 3.10'
pod 'RealmSwift', '~> 3.15'
pod 'Realm', '~> 3.15'

target 'RealmPlatformTests' do
inherit! :search_paths
Expand Down
89 changes: 44 additions & 45 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
PODS:
- Alamofire (4.7.3)
- Nimble (7.3.1)
- Alamofire (4.8.2)
- Nimble (8.0.1)
- QueryKit (0.13.0)
- Realm (3.11.1):
- Realm/Headers (= 3.11.1)
- Realm/Headers (3.11.1)
- RealmSwift (3.11.1):
- Realm (= 3.11.1)
- RxAlamofire (4.3.0):
- RxAlamofire/Core (= 4.3.0)
- RxAlamofire/Core (4.3.0):
- Alamofire (~> 4.5)
- RxSwift (~> 4)
- RxAtomic (4.4.0)
- RxBlocking (4.4.0):
- RxAtomic (~> 4.4)
- RxSwift (~> 4.0)
- RxCocoa (4.4.0):
- RxSwift (~> 4.0)
- RxRealm (0.7.6):
- RealmSwift (~> 3.0)
- RxSwift (~> 4.0)
- RxSwift (4.4.0):
- RxAtomic (~> 4.4)
- RxTest (4.4.0):
- RxAtomic (~> 4.4)
- RxSwift (~> 4.0)
- Realm (3.15.0):
- Realm/Headers (= 3.15.0)
- Realm/Headers (3.15.0)
- RealmSwift (3.15.0):
- Realm (= 3.15.0)
- RxAlamofire (5.0.0):
- RxAlamofire/Core (= 5.0.0)
- RxAlamofire/Core (5.0.0):
- Alamofire (~> 4.8)
- RxSwift (~> 5.0)
- RxBlocking (5.0.0):
- RxSwift (~> 5)
- RxCocoa (5.0.0):
- RxRelay (~> 5)
- RxSwift (~> 5)
- RxRealm (1.0.0):
- RealmSwift (~> 3.14)
- RxSwift (~> 5.0)
- RxRelay (5.0.0):
- RxSwift (~> 5)
- RxSwift (5.0.0)
- RxTest (5.0.0):
- RxSwift (~> 5)

DEPENDENCIES:
- Alamofire
- Nimble
- QueryKit
- Realm (~> 3.10)
- RealmSwift (~> 3.10)
- Realm (~> 3.15)
- RealmSwift (~> 3.15)
- RxAlamofire
- RxBlocking
- RxCocoa (~> 4.0)
- RxRealm (~> 0.7.1)
- RxSwift (~> 4.0)
- RxCocoa (~> 5.0)
- RxRealm (~> 1.0.0)
- RxSwift (~> 5.0)
- RxTest

SPEC REPOS:
Expand All @@ -48,27 +47,27 @@ SPEC REPOS:
- Realm
- RealmSwift
- RxAlamofire
- RxAtomic
- RxBlocking
- RxCocoa
- RxRealm
- RxRelay
- RxSwift
- RxTest

SPEC CHECKSUMS:
Alamofire: c7287b6e5d7da964a70935e5db17046b7fde6568
Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
Nimble: 45f786ae66faa9a709624227fae502db55a8bdd0
QueryKit: 406c42b9b4eb5f8dab380a9e5bd9ef656542d1f4
Realm: 037c5919b9ceb59d6beed5d3b031096856b119b3
RealmSwift: c9580133e73ef40ed340401af2dbc9a5790dfea7
RxAlamofire: 09624d0f2d48ed8b686e4eb4cf68e28cbd2df556
RxAtomic: eacf60db868c96bfd63320e28619fe29c179656f
RxBlocking: 138ad53217434444d6eeeb4fb406a45431d92e31
RxCocoa: df63ebf7b9a70d6b4eeea407ed5dd4efc8979749
RxRealm: 5379eddd74f8d617ca7681d1f8d144af25b432b0
RxSwift: 5976ecd04fc2fefd648827c23de5e11157faa973
RxTest: 19d03286bdc0a3aaea5d61d4cde31fdf4bb8a5ba
Realm: 9b834e1be6062f544805252c812348872dc5d4ed
RealmSwift: 8a41886f8ab6efef9eb8df97de2f2bb911561a79
RxAlamofire: e7875a012aff55345672d0f70a2a9cd6aeb0f211
RxBlocking: c67185d26498ea3cbe3e121917c3c16739e43123
RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8
RxRealm: 1e81dcfca1fb50c3e9b3e1f8102bc875c5156a2e
RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18
RxSwift: 8b0671caa829a763bbce7271095859121cbd895f
RxTest: 4349afe98f564e0a9bc19063368904622d17d49a

PODFILE CHECKSUM: 8587d87d88ab80217209b0a3b29c2c6130be8755
PODFILE CHECKSUM: 3fe950084e8802fb5c8e702b7d49ccceb1bc42a6

COCOAPODS: 1.5.3
COCOAPODS: 1.6.2
3 changes: 1 addition & 2 deletions RealmPlatform/Utility/Extensions/Realm+Ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ extension Object {

extension SortDescriptor {
init(sortDescriptor: NSSortDescriptor) {
self.keyPath = sortDescriptor.key ?? ""
self.ascending = sortDescriptor.ascending
self.init(keyPath: sortDescriptor.key ?? "", ascending: sortDescriptor.ascending)
}
}

Expand Down

0 comments on commit 3bcf782

Please sign in to comment.