diff --git a/Example/RxCocoa-Texture.xcodeproj/project.pbxproj b/Example/RxCocoa-Texture.xcodeproj/project.pbxproj index 6ec2f86..c007a23 100644 --- a/Example/RxCocoa-Texture.xcodeproj/project.pbxproj +++ b/Example/RxCocoa-Texture.xcodeproj/project.pbxproj @@ -67,7 +67,7 @@ 9B0E15FA210DA33F0013EC86 /* ASEditableTextNode+RxSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ASEditableTextNode+RxSpec.swift"; sourceTree = ""; }; 9B0E15FB210DA33F0013EC86 /* ASNetworkImageNode+RxSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ASNetworkImageNode+RxSpec.swift"; sourceTree = ""; }; 9B0E15FC210DA33F0013EC86 /* ASImageNode+RxSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ASImageNode+RxSpec.swift"; sourceTree = ""; }; - 9B0E161B210DAD540013EC86 /* RepositoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryViewController.swift; sourceTree = ""; }; + 9B0E161B210DAD540013EC86 /* RepositoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = RepositoryViewController.swift; sourceTree = ""; tabWidth = 4; }; 9B0E1620210DAD6C0013EC86 /* RepoProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoProvider.swift; sourceTree = ""; }; 9B0E1625210DAD7B0013EC86 /* Decoder+extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Decoder+extension.swift"; sourceTree = ""; }; 9B0E1628210DAD880013EC86 /* Repository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = ""; }; @@ -355,6 +355,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -667,6 +668,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = JTEXWEH4CZ; INFOPLIST_FILE = "RxCocoa-Texture/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; @@ -686,6 +688,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = JTEXWEH4CZ; INFOPLIST_FILE = "RxCocoa-Texture/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; diff --git a/Example/RxCocoa-Texture/RepoProvider.swift b/Example/RxCocoa-Texture/RepoProvider.swift index f603005..dfa1a3e 100644 --- a/Example/RxCocoa-Texture/RepoProvider.swift +++ b/Example/RxCocoa-Texture/RepoProvider.swift @@ -13,7 +13,7 @@ struct RepoProvider { private static let repoRelay = BehaviorRelay<[Int: (repo: Repository, count: Int, updatedAt: Date)]>(value: [:]) private static let repoObservable = repoRelay .asObservable() - .subscribeOn(SerialDispatchQueueScheduler(queue: queue, internalSerialQueueName: UUID().uuidString)) + .subscribe(on: SerialDispatchQueueScheduler(queue: queue, internalSerialQueueName: UUID().uuidString)) .share(replay: 1, scope: .whileConnected) private static let queue = DispatchQueue(label: "RepoProvider.RxMVVMTexture.com", qos: .utility) diff --git a/Example/RxCocoa-Texture/RepositoryViewController.swift b/Example/RxCocoa-Texture/RepositoryViewController.swift index 9a6bf0a..e86603e 100644 --- a/Example/RxCocoa-Texture/RepositoryViewController.swift +++ b/Example/RxCocoa-Texture/RepositoryViewController.swift @@ -10,14 +10,14 @@ import AsyncDisplayKit import RxSwift import RxCocoa -class RepositoryViewController: ASViewController { +class RepositoryViewController: ASDKViewController { private var items: [RepositoryViewModel2] = [] private var context = ASBatchContext() let disposeBag = DisposeBag() - init() { + override init() { let tableNode = ASTableNode(style: .plain) tableNode.backgroundColor = .white tableNode.automaticallyManagesSubnodes = true @@ -49,29 +49,28 @@ class RepositoryViewController: ASViewController { func loadMoreRepo(since: Int?) { _ = RepoService.loadRepository(params: [.since(since)]) .delay(.milliseconds(500), scheduler: MainScheduler.asyncInstance) - .subscribeOn(ConcurrentDispatchQueueScheduler(qos: .default)) + .subscribe(on: ConcurrentDispatchQueueScheduler(qos: .default)) .map { $0.map { RepositoryViewModel2(repository: $0) } } - .observeOn(MainScheduler.instance) .subscribe(onSuccess: { [weak self] items in - guard let `self` = self else { return } + guard let `self` = self else { return } + + if since == nil { + self.items = items + self.node.reloadData() + self.context.completeBatchFetching(true) + } else { + // appending is good at table performance + let updateIndexPaths = items.enumerated() + .map { offset, _ -> IndexPath in + return IndexPath(row: self.items.count - 1 + offset, section: 0) + } - if since == nil { - self.items = items - self.node.reloadData() - self.context.completeBatchFetching(true) - } else { - // appending is good at table performance - let updateIndexPaths = items.enumerated() - .map { offset, _ -> IndexPath in - return IndexPath(row: self.items.count - 1 + offset, section: 0) - } - - self.items.append(contentsOf: items) - self.node.insertRows(at: updateIndexPaths, - with: .fade) - self.context.completeBatchFetching(true) - } - }, onError: { [weak self] error in + self.items.append(contentsOf: items) + self.node.insertRows(at: updateIndexPaths, + with: .fade) + self.context.completeBatchFetching(true) + } + }, onFailure: { [weak self] error in guard let `self` = self else { return } self.context.completeBatchFetching(true) }) diff --git a/RxCocoa-Texture.podspec b/RxCocoa-Texture.podspec index 27b75bf..e8ad939 100644 --- a/RxCocoa-Texture.podspec +++ b/RxCocoa-Texture.podspec @@ -10,11 +10,11 @@ Pod::Spec.new do |s| s.author = { 'Geektree0101' => 'h2s1880@gmail.com' } s.source = { :git => 'https://github.com/RxSwiftCommunity/RxCocoa-Texture.git', :tag => s.version.to_s } - s.ios.deployment_target = '9.0' + s.ios.deployment_target = '10.0' s.swift_version = '5.0' s.source_files = 'RxCocoa-Texture/Classes/**/*' - s.dependency 'RxSwift', '~> 5.0' - s.dependency 'RxCocoa', '~> 5.0' - s.dependency 'Texture', '~> 2.7' + s.dependency 'RxSwift', '~> 6.0.0' + s.dependency 'RxCocoa', '~> 6.0.0' + s.dependency 'Texture', '~> 3.0.0' end diff --git a/RxCocoa-Texture/Classes/ASControlNode+Rx.swift b/RxCocoa-Texture/Classes/ASControlNode+Rx.swift index e585bbe..77a8f87 100644 --- a/RxCocoa-Texture/Classes/ASControlNode+Rx.swift +++ b/RxCocoa-Texture/Classes/ASControlNode+Rx.swift @@ -32,7 +32,7 @@ extension Reactive where Base: ASControlNode { return Disposables.create(with: controlTarget.dispose) } - .takeUntil(deallocated) + .take(until: deallocated) return ControlEvent(events: source) } @@ -63,7 +63,7 @@ extension Reactive where Base: ASControlNode { return Disposables.create(with: controlTarget.dispose) } - .takeUntil(deallocated) + .take(until: deallocated) let bindingObserver = ASBinder(base, binding: setter) diff --git a/RxCocoa-Texture/Classes/ASEditableTextNode+Rx.swift b/RxCocoa-Texture/Classes/ASEditableTextNode+Rx.swift index 9ced30c..dec2c39 100644 --- a/RxCocoa-Texture/Classes/ASEditableTextNode+Rx.swift +++ b/RxCocoa-Texture/Classes/ASEditableTextNode+Rx.swift @@ -21,7 +21,7 @@ extension Reactive where Base: ASEditableTextNode { let attrText = editableTextNode?.attributedText let textChanged: Observable = editableTextNode?.rx.delegate.methodInvoked(#selector(ASEditableTextNodeDelegate.editableTextNodeDidUpdateText(_:))) - .observeOn(MainScheduler.asyncInstance) + .observe(on :MainScheduler.asyncInstance) .map { _ in return editableTextNode?.attributedText }