Skip to content

Commit

Permalink
Merge branch 'release/0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigran Hambardzumyan committed Apr 20, 2018
2 parents 0b3c091 + 4c6c2ff commit 4f2af71
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 43 deletions.
45 changes: 27 additions & 18 deletions Example/Example.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ example("allowTrue") {

Observable.of(true, false, false, true, true)
.allowTrue()
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}
Expand All @@ -34,7 +34,7 @@ example("allowTrue Optional") {

Observable.of(true, false, nil, true, nil, true)
.allowTrue()
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}
Expand All @@ -45,7 +45,7 @@ example("allowFalse") {

Observable.of(true, false, false, true, false)
.allowFalse()
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}
Expand All @@ -56,7 +56,7 @@ example("allowFalse Optional") {

Observable.of(true, false, nil, true, nil, true, false)
.allowFalse()
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}
Expand All @@ -66,7 +66,7 @@ example("allowTrueOrNil") {

Observable.of(true, false, nil, true, nil, true, false)
.allowTrueOrNil()
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}
Expand All @@ -76,9 +76,9 @@ example("allowFalseOrNil") {

Observable.of(true, false, nil, true, nil, true, false)
.allowFalseOrNil()
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}

example("filterIfNil") {
Expand All @@ -91,14 +91,14 @@ example("filterIfNil") {

subject
.filterIfNil(optional)
.subscribe(onNext: { print("Subscription1 --> \($0)") })
.subscribe(onNext: { dump($0, name: "Subscription1") })
.disposed(by: disposeBag)

optional = "enable"

subject
.filterIfNil(optional)
.subscribe(onNext: { print("Subscription2 --> \($0)") })
.subscribe(onNext: { dump($0, name: "Subscription2") })
.disposed(by: disposeBag)

subject.onNext("🐹")
Expand All @@ -116,32 +116,41 @@ example("filterIfNotNil") {

subject
.filterIfNotNil(optional)
.subscribe(onNext: { print("Subscription1 --> \($0)") })
.subscribe(onNext: { dump($0, name: "Subscription1") })
.disposed(by: disposeBag)

optional = "enable"

subject
.filterIfNotNil(optional)
.subscribe(onNext: { print("Subscription2 --> \($0)") })
.subscribe(onNext: { dump($0, name: "Subscription2") })
.disposed(by: disposeBag)

subject.onNext("🐹")

subject.onNext("🐭")
}

example("Allow nil") {
let disposeBag = DisposeBag()

Observable.of(true, false, nil, true, nil, true, false)
.allowNil()
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)
}

/*:
## Map Extensions
*/
*/

example("map(to:)") {

let disposeBag = DisposeBag()

Observable.of(1, 5, 7, 8)
.map(to: "ping")
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0 as String) })
.disposed(by: disposeBag)

}
Expand All @@ -158,26 +167,26 @@ example("map(at:)") {

observable
.map(at: \.title)
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

observable
.map(at: \.author.firstName)
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}

/*:
## Cast Extensions
*/
*/

example("cast(to:)") {
let disposeBag = DisposeBag()

Observable<CustomStringConvertible>.of("1", "5", "7", "8")
.cast(to: String.self)
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}
Expand All @@ -187,7 +196,7 @@ example("forceCast(to:)") {

Observable<CustomStringConvertible>.of("1", "5", "7", "8")
.forceCast(to: String.self)
.subscribe(onNext: { print($0) })
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}
8 changes: 4 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PODS:
- RxCocoa (4.1.2):
- RxSwift (~> 4.0)
- RxSwift (4.1.2)
- STDevRxExt (0.1.0):
- STDevRxExt (0.1.1):
- RxCocoa (~> 4.1.2)
- RxSwift (~> 4.1.2)

Expand All @@ -16,8 +16,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
RxCocoa: d88ba0f1f6abf040011a9eb4b539324fc426843a
RxSwift: e49536837d9901277638493ea537394d4b55f570
STDevRxExt: 523757c19d070f1183ed46f3c262671e3f549467
STDevRxExt: db625d87a2f2f74ce2f9efb869b020e944781851

PODFILE CHECKSUM: f42840d4bfdb7c3c06cec77f4e686adfdc3604f1
PODFILE CHECKSUM: 03f0d9ab6a3ddca86ac78ea53d2cfc1bef03c8f8

COCOAPODS: 1.4.0
COCOAPODS: 1.3.1
38 changes: 21 additions & 17 deletions Example/STDevRxExt.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
607FACE21AFB9204008FA782 /* Frameworks */,
607FACE31AFB9204008FA782 /* Resources */,
ABFFA786528145F941134D7B /* [CP] Embed Pods Frameworks */,
CCB8043419D447B3CFB8B185 /* [CP] Copy Pods Resources */,
1314E7A7F724A441011AC3F2 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -130,7 +130,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACE41AFB9204008FA782 = {
Expand Down Expand Up @@ -169,6 +169,21 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
1314E7A7F724A441011AC3F2 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-STDevRxExt_Tests/Pods-STDevRxExt_Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
A3707137EA0E0FF550D3D5D1 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -209,21 +224,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-STDevRxExt_Tests/Pods-STDevRxExt_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
CCB8043419D447B3CFB8B185 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-STDevRxExt_Tests/Pods-STDevRxExt_Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -250,12 +250,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -303,12 +305,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,7 +40,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -70,7 +69,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion STDevRxExt.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'STDevRxExt'
s.version = '0.1.1'
s.version = '0.1.2'
s.summary = 'STDevRxExt contains some extension functions for RxSwift and RxCoca which makes our live easy.'

s.description = <<-DESC
Expand Down
8 changes: 8 additions & 0 deletions STDevRxExt/Classes/FilterExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public extension ObservableType {

}

public extension ObservableType where E == Optional<Any> {

public func allowNil() -> Observable<E> {
return filter { $0 == nil }
}

}

public extension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy, E == Bool {

public func allowTrue() -> Driver<Bool> {
Expand Down

0 comments on commit 4f2af71

Please sign in to comment.