Skip to content

Commit

Permalink
Merge pull request #11 from hamtiko/master
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
Tigran Hambardzumyan authored Aug 7, 2020
2 parents f450333 + 2787b4f commit a360176
Show file tree
Hide file tree
Showing 23 changed files with 1,485 additions and 172 deletions.
73 changes: 61 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,75 @@ on:
branches: [ master ]

jobs:
build:
MacOS:
name: macOS
runs-on: macos-10.15
env:
WORKSPACE: Example/STDevRxExt.xcworkspace
DEVELOPER_DIR: /Applications/Xcode_11.app/Contents/Developer
PROJECT: STDevRxExt.xcodeproj
SCHEME: STDevRxExt-Package
DEVELOPER_DIR: /Applications/Xcode_11.5.app/Contents/Developer

steps:

- uses: actions/checkout@v2


- name: Bundle Install
run: bundle install

- name: CocoaPods
run: |
gem install cocoapods
pod install --project-directory=Example --repo-update
- name: Restore SPM Cache
uses: actions/cache@v1
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build and test (SPM)
run: |
swift build
swift test
- name: Generate Xcodeproj
run: |
swift package generate-xcodeproj
- name: Test iOS
run: xcodebuild test -enableCodeCoverage YES -workspace $WORKSPACE -scheme $SCHEME -destination "$DESTINATION" ONLY_ACTIVE_ARCH=NO | xcpretty
run: |
xcodebuild clean build test -project $PROJECT -scheme $SCHEME -destination "$DESTINATION" | XCPRETTY_JSON_FILE_OUTPUT="xcodebuild-ios.json" xcpretty -f `xcpretty-json-formatter`
env:
SCHEME: STDevRxExt-Example
DESTINATION: 'platform=iOS Simulator,name=iPhone 8,OS=13.0'

- name: Pod Lib Lint
run: pod lib lint --allow-warnings
DESTINATION: platform=iOS Simulator,name=iPhone 11

- name: Test MacOS
run: |
xcodebuild clean build test -project $PROJECT -scheme $SCHEME -destination "$DESTINATION" | XCPRETTY_JSON_FILE_OUTPUT="xcodebuild-macos.json" xcpretty -f `xcpretty-json-formatter`
env:
DESTINATION: platform=OS X

- name: Test TVOS
run: |
xcodebuild clean build test -project $PROJECT -scheme $SCHEME -destination "$DESTINATION" | XCPRETTY_JSON_FILE_OUTPUT="xcodebuild-tvos.json" xcpretty -f `xcpretty-json-formatter`
env:
DESTINATION: platform=tvOS Simulator,name=Apple TV 4K (at 1080p)

- name: Build WatchOS
run: xcodebuild clean build -project $PROJECT -scheme $SCHEME -destination "$DESTINATION"
env:
DESTINATION: name=Apple Watch Series 5 - 40mm

CocoaPods:
name: CocoaPods
runs-on: macos-10.15
strategy:
matrix:
platform: ['ios', 'macos', 'tvos', 'watchos']
env:
DEVELOPER_DIR: /Applications/Xcode_11.5.app/Contents/Developer
steps:
- uses: actions/checkout@v1

- name: CocoaPods ${{ matrix.platform }}
run: pod lib lint --skip-tests --allow-warnings --verbose --platforms=${{ matrix.platform }}
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release

on:
push:
tags: '*'

jobs:
push:
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2

- name: Deploy to Cocoapods
run: |
set -eo pipefail
pod lib lint --allow-warnings
pod trunk push --allow-warnings
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ Carthage/Build
# `pod install` in .travis.yml
#
Pods/

# Swift Package Manager
.build
Package.resolved
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 12 additions & 81 deletions Example/Example.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,49 @@
----
*/

import UIKit
import STDevRxExt
import RxSwift
import RxCocoa
import RxSwift
import STDevRxExt
import UIKit

/*:
## Filter Extensions
*/
*/

example("allowTrue") {

let disposeBag = DisposeBag()

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

}

example("allowTrue Optional") {

let disposeBag = DisposeBag()

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

}

example("allowFalse") {

let disposeBag = DisposeBag()

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

}

example("allowFalse Optional") {

let disposeBag = DisposeBag()

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

}

example("allowTrueOrNil") {
Expand All @@ -68,7 +60,6 @@ example("allowTrueOrNil") {
.allowTrueOrNil()
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}

example("allowFalseOrNil") {
Expand All @@ -78,57 +69,6 @@ example("allowFalseOrNil") {
.allowFalseOrNil()
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}

example("filterIfNil") {

let disposeBag = DisposeBag()

var optional: String? = nil

let subject = PublishSubject<String>()

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

optional = "enable"

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

subject.onNext("🐹")

subject.onNext("🐭")
}

example("filterIfNotNil") {

let disposeBag = DisposeBag()

var optional: String? = nil

let subject = PublishSubject<String>()

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

optional = "enable"

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

subject.onNext("🐹")

subject.onNext("🐭")
}

example("Allow nil") {
Expand All @@ -142,28 +82,25 @@ example("Allow nil") {

/*:
## Map Extensions
*/
*/

example("map(to:)") {

let disposeBag = DisposeBag()

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

}

example("map(at:)") {
let disposeBag = DisposeBag()

let disposeBag = DisposeBag()

let observable = Observable.of(
Book(title: "Twenty Thousand Leagues Under the Sea", author: Author("Jules", "Verne")),
Book(title: "Hamlet", author: Author("William", "Shakespeare")),
Book(title: "Hearts of Three", author: Author("Jack", "London"))
)
let observable = Observable.of(
Book(title: "Twenty Thousand Leagues Under the Sea", author: Author("Jules", "Verne")),
Book(title: "Hamlet", author: Author("William", "Shakespeare")),
Book(title: "Hearts of Three", author: Author("Jack", "London"))
)

observable
.map(at: \.title)
Expand All @@ -174,12 +111,10 @@ example("map(at:)") {
.map(at: \.author.firstName)
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}

/*:
## Cast Extensions
*/
*/

example("cast(to:)") {
let disposeBag = DisposeBag()
Expand All @@ -188,7 +123,6 @@ example("cast(to:)") {
.cast(to: String.self)
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}

example("forceCast(to:)") {
Expand All @@ -198,7 +132,6 @@ example("forceCast(to:)") {
.forceCast(to: String.self)
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)

}

/*:
Expand All @@ -218,6 +151,4 @@ example("update(_:with:)") {
.update(subject, with: true)
.subscribe(onNext: { dump($0) })
.disposed(by: disposeBag)


}
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ SPEC CHECKSUMS:
RxCocoa: 32065309a38d29b5b0db858819b5bf9ef038b601
RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9
RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178
STDevRxExt: 2bd7d233a4990c8e227b6af52ac3cc51e7ecb333
STDevRxExt: 57d7368115b81b92e06728276504ece2c52fda2b

PODFILE CHECKSUM: 83769abc0b7bdc83a928dcac34cf2b1154077760

COCOAPODS: 1.9.1
COCOAPODS: 1.9.3
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'xcpretty'
gem 'xcpretty-json-formatter'
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
GEM
remote: https://rubygems.org/
specs:
rouge (2.0.7)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-json-formatter (0.1.1)
xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
ruby

DEPENDENCIES
xcpretty
xcpretty-json-formatter

BUNDLED WITH
2.1.4
36 changes: 36 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// swift-tools-version:5.0

import PackageDescription

let package = Package(
name: "STDevRxExt",
platforms: [
.macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v3),
],
products: [
.library(
name: "STDevRxExt",
targets: ["STDevRxExt"]
),
],
dependencies: [
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.1.0")),
],
targets: [
.target(
name: "STDevRxExt",
dependencies: [
.product(name: "RxSwift", package: "RxSwift"),
.product(name: "RxCocoa", package: "RxSwift"),
]
),
.testTarget(
name: "STDevRxExtTests",
dependencies: [
"STDevRxExt",
.product(name: "RxTest", package: "RxSwift")
]
),
],
swiftLanguageVersions: [.v5]
)
Loading

0 comments on commit a360176

Please sign in to comment.