-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doc updates and initial promise tests (#49)
* Fix failure to compile Signed-off-by: EandJsFilmCrew <789213+rvsrvs@users.noreply.github.com> * rename function arguments appropriately Signed-off-by: EandJsFilmCrew <789213+rvsrvs@users.noreply.github.com> * Documentation udpates Signed-off-by: EandJsFilmCrew <789213+rvsrvs@users.noreply.github.com> * Initial Promise test working Signed-off-by: EandJsFilmCrew <789213+rvsrvs@users.noreply.github.com>
- Loading branch information
Showing
24 changed files
with
238 additions
and
80 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...Free Design.playground/Pages/01 - Lost Type Relationships.xcplaygroundpage/Contents.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,40 @@ | ||
//: [Previous](@previous) | ||
|
||
/*: | ||
## The "Crusty" Talk | ||
![The Crusty Talk](POP-1.pdf) | ||
|
||
## The 3 Beefs | ||
![The Three Beefs](POP-2.pdf) | ||
|
||
## Concurrency | ||
![The Crusty Talk](POP-3.pdf) | ||
|
||
## Single Inheritance | ||
![The Crusty Talk](POP-4.pdf) | ||
|
||
## Lost Type Relationships | ||
![The Crusty Talk](POP-5.pdf) | ||
|
||
## The Tell-tale Sign | ||
![The Crusty Talk](POP-6.pdf) | ||
|
||
## Protocol Oriented Programming | ||
![The Crusty Talk](POP-7.pdf) | ||
|
||
## The Challenge: Prove It! | ||
![The Crusty Talk](POP-8.pdf) | ||
|
||
## Demand only comes in More and All | ||
![Demand](Demand.png) | ||
|
||
## The Tell-tale Sign: Protocol Edition | ||
![Return Types in Combine](CombineReturnTypes.png) | ||
|
||
## Protocols have problems too | ||
![Swift Evolution Proposal 335](SE-335.png) | ||
|
||
|
||
*/ | ||
|
||
//: [Next](@next) |
Binary file modified
BIN
-64 KB
(74%)
Playgrounds/01 - Protocol Free Design.playground/Resources/Demand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
Playgrounds/01 - Protocol Free Design.playground/contents.xcplayground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 22 additions & 19 deletions
41
Playgrounds/06 - Publishers.playground/Pages/07-Zipped.xcplaygroundpage/Contents.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,33 @@ | ||
//: [Previous](@previous) | ||
|
||
import FreeCombine | ||
import PlaygroundSupport | ||
PlaygroundPage.current.needsIndefiniteExecution = true | ||
|
||
var count = 0 | ||
import FreeCombine | ||
|
||
let counter = Counter() | ||
var publisher1 = (0 ... 100).asyncPublisher | ||
var publisher2 = "abcdefghijklmnopqrstuvwxyz".asyncPublisher | ||
|
||
let cancellable = Zipped(publisher1, publisher2) | ||
.map { ($0.0 + 100, $0.1.uppercased()) } | ||
.sink(onStartup: .none) { result in | ||
switch result { | ||
case let .value(value): | ||
print(value) | ||
count += 1 | ||
case let .completion(.failure(error)): | ||
print("WTF? \(error)") | ||
case .completion(.finished): | ||
print("Done") | ||
case .completion(.cancelled): | ||
print("Cancelled") | ||
} | ||
return .more | ||
@Sendable func zipSink(_ result: AsyncStream<(Int, String)>.Result) async -> Demand { | ||
switch result { | ||
case let .value(value): | ||
print(value) | ||
await counter.increment() | ||
case let .completion(.failure(error)): | ||
print("WTF? \(error)") | ||
case .completion(.finished): | ||
print("Done") | ||
case .completion(.cancelled): | ||
print("Cancelled") | ||
} | ||
return .more | ||
} | ||
|
||
let cancellable = await Zipped(publisher1, publisher2) | ||
.map { ($0.0 + 100, $0.1.uppercased()) } | ||
.sink(zipSink) | ||
|
||
cancellable | ||
let count = await counter.count | ||
await cancellable.result | ||
|
||
//: [Next](@next) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.