WWDC19
=================
- Introducing Combine and Advances in Foundation - Thursday
- Foundation Updates
- Swift Updates * Scanner * FileHandle
- Introducing Combine -> The replacement for Rx!
Session materials: https://developer.apple.com/videos/play/wwdc2019/711/
let diff = bird.difference(from: bear)
let newBird = bear.applying(diff) // [b, i, r, d]
- Applicable to any collection type
struct Data
becomes contiguouspublic protocol ContiguousByte
let compressed = try data.compressed(using: BUILT_IN_COMPRESSION_ALGORITHM_ENUMS)
- Added new
UnitDuration
s & a newUnitFrequency
UnitInformationStorage
- Relative Date Time Formatter!!!!
let listFormatter = ListFormatter()
let dateFormatter = dateFormatter()
listFormatter.itemFormatter = dateFormatter
let string = listFormatter.string(from: dates)
queue.addBarrierBlock {
save()
}
- This guarantees that a given task is the only one running at a given particular time. Blocks the other remaining ones
let queue = OperationQueue()
queue.progressCount = SomeNumber
- Be prepared for UWSB and SMB on iOS to take multiple and disappearing volumes into account
scanUpToCharacters(from:) & scanString()
-
A new error-based API
-
Use
DataProtocol
instead if [UIInt8]` -
Format dates and lists with
Formatter
-
Use
OperationQueue
s barrier and progress reporting
- A unified declarative API for processing values over time
- Generic
- Type safe
- Composition first
- Request driven
- Defines how values and error are produced
- One key function: "subscribe"
- Value type
- Reference type
- It can receive one subscription. N inputs and one completion
-
Like a mapper between Publisher and Subscriber
-
Adopts
Publisher
-
struct Map
-
Ability to chain operators exactly like RxSwift
-
Chaining results in a cancellable
-
Combine adopts many known Rx patterns