Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DIY your own Combine framework
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Li-Heng Hsu
September 22, 2019
Programming
0
1.1k
DIY your own Combine framework
Li-Heng Hsu
September 22, 2019
Tweet
Share
Other Decks in Programming
See All in Programming
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
730
Implementation Patterns
denyspoltorak
0
290
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
130
Package Management Learnings from Homebrew
mikemcquaid
0
220
組織で育むオブザーバビリティ
ryota_hnk
0
180
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
290
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
130
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
710
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.1k
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
From π to Pie charts
rasagy
0
120
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
3.9k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.6k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
78
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Are puppies a ranking factor?
jonoalderson
1
2.7k
Scaling GitHub
holman
464
140k
Transcript
DIY your own Combine framework Basic Functional Reactive Programming concepts
Li-Heng Hsu 許立衡 @ iPlayground 2019
– Apple documentation "The Combine framework provides a declarative Swift
API for processing values over time."
None
Concepts • Builder pattern • map(_:) method
Builder pattern • For constructing instances • Like initializer, factory
method… 1. Create a builder struct 2. Store construction info in it 3. Call its build() method to construct a product
URLComponents URL builder
Combine Subscription builder
Builder pattern Combine Builder Publisher Construction info Operator build() Subscriber
Product Subscription Roles
CombineDIY.swift
map(_:) method • There are different worlds in code •
World of Uncertainty, World of Plurality, World of Erroneous... • Instances in these worlds can't be manipulated normally
Optional World of Uncertainty
World of Uncertainty Cat? (Cat) -> Double (Cat?) -> Double?
map(_:)
None
Imperative Functional Metaphor Unwrap values Stack operations Optional if let
x = x { /* ... */ } x.map { x in /* ... */ } Collection for i in x { /* ... */ } x.forEach { i in /* ... */ } Result if case .success(let x) = result { /* ... */ } result.map { x in /* ... */ }
World of Plurality [Cat] (Cat) -> Double ([Cat]) -> [Double]
map(_:)
World of Temporality Publisher<Cat> (Cat) -> Double (Publisher<Cat>) -> Publisher<Double>
map(_:)
DIY map(_:)
Feedback Come find me! Twitter: @lihenghsu