Skip to content

Commit

Permalink
RxSwiftExt 6
Browse files Browse the repository at this point in the history
  • Loading branch information
freak4pc committed Jan 2, 2021
1 parent 7630239 commit 89ebf7d
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 244 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
XCODE_TEST_REPORTS: /tmp/xcode-test-results
LANG: en_US.UTF-8
macos:
xcode: '10.2.0'
xcode: '12.3.0'
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS $XCODE_TEST_REPORTS
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
environment:
LANG: en_US.UTF-8
macos:
xcode: '10.2.0'
xcode: '12.3.0'
steps:
- checkout
- run:
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveX/RxSwift" ~> 5.0
github "ReactiveX/RxSwift" "6.0.0"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveX/RxSwift" "5.0.1"
github "ReactiveX/RxSwift" "6.0.0"
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import PackageDescription
let package = Package(
name: "RxSwiftExt",
platforms: [
.iOS(.v8), .tvOS(.v9), .macOS(.v10_11), .watchOS(.v3)
.iOS(.v9), .tvOS(.v9), .macOS(.v10_11), .watchOS(.v3)
],
products: [
.library(name: "RxSwiftExt", targets: ["RxSwiftExt"]),
],
dependencies: [
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.0.0")),
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.0.0")),
],
targets: [
.target(name: "RxSwiftExt", dependencies: ["RxSwift", "RxCocoa"], path: "Source"),
.testTarget(name: "RxSwiftExtTests", dependencies: ["RxSwiftExt", "RxTest"], path: "Tests"),
],
swiftLanguageVersions: [.v4_2, .v5]
swiftLanguageVersions: [.v5]
)
35 changes: 0 additions & 35 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ These operators are much like the RxSwift & RxCocoa core operators, but provide
* [Observable.fromAsync](#fromasync)
* [Observable.zip(with:)](#zipwith)
* [Observable.merge(with:)](#mergewith)
* [withUnretained](#withunretained)
* [count](#count)
* [partition](#partition)
* [bufferWithTrigger](#bufferWithTrigger)
Expand Down Expand Up @@ -565,40 +564,6 @@ completed
```
This example emits 2, 5 (`NSDecimalNumber` Type).

#### withUnretained

The `withUnretained(_:resultSelector:)` operator provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.
In the case the provided object cannot be retained successfully, the seqeunce will complete.

```swift
class TestClass: CustomStringConvertible {
var description: String { return "Test Class" }
}

Observable
.of(1, 2, 3, 5, 8, 13, 18, 21, 23)
.withUnretained(testClass)
.do(onNext: { _, value in
if value == 13 {
// When testClass becomes nil, the next emission of the original
// sequence will try to retain it and fail. As soon as it fails,
// the sequence will complete.
testClass = nil
}
})
.subscribe()
```

```
next((Test Class, 1))
next((Test Class, 2))
next((Test Class, 3))
next((Test Class, 5))
next((Test Class, 8))
next((Test Class, 13))
completed
```

#### [count](http://reactivex.io/documentation/operators/count.html)

Emits the number of items emitted by an Observable once it terminates with no errors. If a predicate is given, only elements matching the predicate will be counted.
Expand Down
8 changes: 4 additions & 4 deletions RxSwiftExt.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "RxSwiftExt"
s.version = "5.2.0"
s.version = "6.0.0"
s.summary = "RxSwift operators not found in the core distribtion"
s.description = <<-DESC
A collection of operators for RxSwift adding commonly requested operations not found in the core distribution
Expand All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.license = { :type => "MIT", :file => "LICENSE" }
s.authors = { "RxSwiftCommunity" => "https://github.com/RxSwiftCommunity" }

s.ios.deployment_target = '8.0'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.10'
s.watchos.deployment_target = '3.0'
s.tvos.deployment_target = '9.0'
Expand All @@ -20,13 +20,13 @@ Pod::Spec.new do |s|
s.subspec "Core" do |cs|
cs.source_files = "Source/RxSwift", "Source/Tools"
cs.frameworks = "Foundation"
cs.dependency "RxSwift", '~> 5.0'
cs.dependency "RxSwift", '6.0.0'
end

s.subspec "RxCocoa" do |co|
co.source_files = "Source/RxCocoa"
co.frameworks = "Foundation"
co.dependency "RxCocoa", '~> 5.0'
co.dependency "RxCocoa", '6.0.0'
co.dependency "RxSwiftExt/Core"
end
end
16 changes: 0 additions & 16 deletions RxSwiftExt.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,6 @@
BF515CE91F3F3B0100492640 /* fromAsync.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF515CE11F3F371600492640 /* fromAsync.swift */; };
BF515CEA1F3F3B0300492640 /* curry.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF515CDF1F3F370600492640 /* curry.swift */; };
BF515CEB1F3F3B0300492640 /* curry.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF515CDF1F3F370600492640 /* curry.swift */; };
BF79DA0A206C145D008AA708 /* withUnretained.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF79DA09206C145D008AA708 /* withUnretained.swift */; };
BF79DA0B206C145D008AA708 /* withUnretained.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF79DA09206C145D008AA708 /* withUnretained.swift */; };
BF79DA0C206C145D008AA708 /* withUnretained.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF79DA09206C145D008AA708 /* withUnretained.swift */; };
BF79DA0E206C185B008AA708 /* WithUnretainedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF79DA0D206C185B008AA708 /* WithUnretainedTests.swift */; };
BF79DA0F206C185B008AA708 /* WithUnretainedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF79DA0D206C185B008AA708 /* WithUnretainedTests.swift */; };
BF79DA10206C185B008AA708 /* WithUnretainedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF79DA0D206C185B008AA708 /* WithUnretainedTests.swift */; };
C4D2153F20118A81009804AE /* ofType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D2153E20118A81009804AE /* ofType.swift */; };
C4D2154220118FB9009804AE /* Observable+OfTypeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D2154020118F8B009804AE /* Observable+OfTypeTests.swift */; };
C4D2154320118FB9009804AE /* Observable+OfTypeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D2154020118F8B009804AE /* Observable+OfTypeTests.swift */; };
Expand Down Expand Up @@ -380,8 +374,6 @@
BF515CDF1F3F370600492640 /* curry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = curry.swift; path = Source/Tools/curry.swift; sourceTree = SOURCE_ROOT; };
BF515CE11F3F371600492640 /* fromAsync.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = fromAsync.swift; path = Source/RxSwift/fromAsync.swift; sourceTree = SOURCE_ROOT; };
BF515CE31F3F3AC900492640 /* FromAsyncTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FromAsyncTests.swift; sourceTree = "<group>"; };
BF79DA09206C145D008AA708 /* withUnretained.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = withUnretained.swift; sourceTree = "<group>"; };
BF79DA0D206C185B008AA708 /* WithUnretainedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithUnretainedTests.swift; sourceTree = "<group>"; };
C4D2153E20118A81009804AE /* ofType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ofType.swift; sourceTree = "<group>"; };
C4D2154020118F8B009804AE /* Observable+OfTypeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+OfTypeTests.swift"; sourceTree = "<group>"; };
D7C72A3D1FDC5C5D00EAAAAB /* NwiseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NwiseTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -565,7 +557,6 @@
538607A91E6F334B000361DE /* unwrap.swift */,
58C54402C636BC3C2F36A4ED /* zipWith.swift */,
C4D2153E20118A81009804AE /* ofType.swift */,
BF79DA09206C145D008AA708 /* withUnretained.swift */,
DC612871209E80810053CBB7 /* mapMany.swift */,
A23E148621A9EFC000CD5B2F /* partition.swift */,
);
Expand Down Expand Up @@ -605,7 +596,6 @@
538607CA1E6F367A000361DE /* WeakTarget.swift */,
538607CB1E6F367A000361DE /* WeakTests.swift */,
58C54E184069446EDEE748F9 /* ZipWithTest.swift */,
BF79DA0D206C185B008AA708 /* WithUnretainedTests.swift */,
A23E148E21A9F10D00CD5B2F /* PartitionTests.swift */,
);
name = RxSwift;
Expand Down Expand Up @@ -1060,7 +1050,6 @@
53F336E81E70CBF700D35D38 /* distinct+RxCocoa.swift in Sources */,
A23E148721A9EFC000CD5B2F /* partition.swift in Sources */,
538607AE1E6F334B000361DE /* ignore.swift in Sources */,
BF79DA0A206C145D008AA708 /* withUnretained.swift in Sources */,
BF515CE01F3F370600492640 /* curry.swift in Sources */,
1958B5F1216768D900CAF1D3 /* unwrap+SharedSequence.swift in Sources */,
5A1DDEBF1ED58F8600F2E4B1 /* pausableBuffered.swift in Sources */,
Expand Down Expand Up @@ -1095,7 +1084,6 @@
538607EA1E6F36A9000361DE /* PausableTests.swift in Sources */,
538607E91E6F36A9000361DE /* OnceTests.swift in Sources */,
A23E149321A9F73500CD5B2F /* PartitionTests+RxCocoa.swift in Sources */,
BF79DA0E206C185B008AA708 /* WithUnretainedTests.swift in Sources */,
538607EE1E6F36A9000361DE /* WeakTests.swift in Sources */,
7819961622844EF800340AF4 /* UIScrollView+reachedBottomTests.swift in Sources */,
780CB21920A0ED3B00FD3F39 /* ToSortedArrayTests.swift in Sources */,
Expand Down Expand Up @@ -1151,7 +1139,6 @@
62512C681F0EAF850083A89F /* mapTo+RxCocoa.swift in Sources */,
62512C791F0EAF950083A89F /* retryWithBehavior.swift in Sources */,
DC612873209E80810053CBB7 /* mapMany.swift in Sources */,
BF79DA0B206C145D008AA708 /* withUnretained.swift in Sources */,
A23E148821A9EFC000CD5B2F /* partition.swift in Sources */,
A23E148C21A9F03600CD5B2F /* partition+RxCocoa.swift in Sources */,
BF515CE81F3F3B0000492640 /* fromAsync.swift in Sources */,
Expand Down Expand Up @@ -1182,7 +1169,6 @@
62512C8F1F0EB17A0083A89F /* DistinctTests+RxCocoa.swift in Sources */,
62512C951F0EB1850083A89F /* DistinctTests.swift in Sources */,
62512CA11F0EB1850083A89F /* UnwrapTests.swift in Sources */,
BF79DA0F206C185B008AA708 /* WithUnretainedTests.swift in Sources */,
62512CA31F0EB1850083A89F /* WeakTests.swift in Sources */,
780CB21A20A0ED3B00FD3F39 /* ToSortedArrayTests.swift in Sources */,
62512C981F0EB1850083A89F /* IgnoreWhenTests.swift in Sources */,
Expand Down Expand Up @@ -1238,7 +1224,6 @@
E39C41D91F18B086007F2ACD /* mapTo+RxCocoa.swift in Sources */,
E39C41EA1F18B08A007F2ACD /* retryWithBehavior.swift in Sources */,
DC612874209E80810053CBB7 /* mapMany.swift in Sources */,
BF79DA0C206C145D008AA708 /* withUnretained.swift in Sources */,
A23E148921A9EFC000CD5B2F /* partition.swift in Sources */,
A23E148D21A9F03600CD5B2F /* partition+RxCocoa.swift in Sources */,
BF515CE91F3F3B0100492640 /* fromAsync.swift in Sources */,
Expand Down Expand Up @@ -1269,7 +1254,6 @@
E39C42011F18B13E007F2ACD /* CascadeTests.swift in Sources */,
E39C42101F18B13E007F2ACD /* WeakTarget.swift in Sources */,
E39C42031F18B13E007F2ACD /* DistinctTests.swift in Sources */,
BF79DA10206C185B008AA708 /* WithUnretainedTests.swift in Sources */,
E39C41FD1F18B13A007F2ACD /* DistinctTests+RxCocoa.swift in Sources */,
780CB21B20A0ED3B00FD3F39 /* ToSortedArrayTests.swift in Sources */,
E39C42051F18B13E007F2ACD /* IgnoreTests.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Source/RxSwift/catchErrorJustComplete.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension ObservableType {
- returns: An observable sequence that never errors and completes when an error occurs in the underlying sequence
*/
public func catchErrorJustComplete() -> Observable<Element> {
return catchError { _ in
return `catch` { _ in
return Observable.empty()
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/RxSwift/fromAsync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public extension PrimitiveSequenceType where Trait == SingleTrait {
case let (.some(result), nil):
single(.success(result))
case let (nil, .some(error)):
single(.error(error))
single(.failure(error))
default:
single(.error(FromAsyncError.inconsistentCompletionResult))
single(.failure(FromAsyncError.inconsistentCompletionResult))
}
}
return Disposables.create()
Expand Down
4 changes: 2 additions & 2 deletions Source/RxSwift/ignoreErrors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ extension ObservableType {
- returns: An observable sequence that errors only when `predicate` returns `false`
*/
public func ignoreErrors(_ predicate : @escaping (Error) -> Bool) -> Observable<Element> {
return retryWhen {
return retry(when: {
return $0.flatMap { error -> Observable<Bool> in
return predicate(error) ? Observable.just(true) : Observable<Bool>.error(error)
}
}
})
}
}
2 changes: 1 addition & 1 deletion Source/RxSwift/repeatWithBehavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension ObservableType {
let conditions = behavior.calculateConditions(currentRepeat)

return concat(Observable.error(RepeatError.catchable))
.catchError {error in
.catch { error in
//if observable errors, forward the error
guard error is RepeatError else {
return Observable.error(error)
Expand Down
2 changes: 1 addition & 1 deletion Source/RxSwift/retryWithBehavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extension ObservableType {
// calculate conditions for bahavior
let conditions = behavior.calculateConditions(currentAttempt)

return catchError { error -> Observable<Element> in
return `catch` { error -> Observable<Element> in
// return error if exceeds maximum amount of retries
guard conditions.maxCount > currentAttempt else { return Observable.error(error) }

Expand Down
51 changes: 0 additions & 51 deletions Source/RxSwift/withUnretained.swift

This file was deleted.

Loading

0 comments on commit 89ebf7d

Please sign in to comment.