File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,12 @@ let package = Package(
1212 )
1313 ] ,
1414 dependencies: [
15- //example:
16- // .package(url: "https://github.com/ReactiveX/RxSwift.git", "4.0.0" ..< "5.0.0")
15+ . package ( url: " https://github.com/ReactiveX/RxSwift.git " , " 4.0.0 " ..< " 5.0.0 " )
1716 ] ,
1817 targets: [
1918 . target(
2019 name: " STSLibrary " ,
21- dependencies: [ ] ) ,
20+ dependencies: [ " RxSwift " ] ) ,
2221 . target(
2322 name: " STSApplication " ,
2423 dependencies: [ " STSLibrary " ] ) ,
Original file line number Diff line number Diff line change @@ -7,5 +7,7 @@ public final class Application {
77
88 public func run( ) throws {
99 print ( " \( prefix) : \( TensorFlowExample . multiplyTensor ( ) ) " )
10+ print ( " \( prefix) : Running RxExample: " )
11+ RxExample . printHello ( )
1012 }
1113}
Original file line number Diff line number Diff line change 1+
2+ import RxSwift
3+ import Foundation
4+
5+ struct RxExample {
6+ static func printHello( ) {
7+ let wordList = [ " Hello " , " Rx " , " World " ]
8+
9+ _ = Observable < Int > . interval ( 1 , scheduler: SerialDispatchQueueScheduler ( qos: . default) )
10+ . take ( wordList. count)
11+ . map { index in wordList [ index] }
12+ . do ( onNext: { word in
13+ print ( word)
14+ } )
15+
16+ // sleep for the duration of the above so the application doesn't exit before completion
17+ Thread . sleep ( forTimeInterval: Double ( wordList. count) )
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments