Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Voidと() - 意図を伝える“ユニット型”の世界- / Void vs () -The W...
Search
marcy731
September 30, 2025
24
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Voidと() - 意図を伝える“ユニット型”の世界- / Void vs () -The World of Expressing Intent
2025.09.30 チキチキ!モバイルLT大会 〜残暑編〜
marcy731
September 30, 2025
More Decks by marcy731
See All by marcy731
沈黙すべきか、叫ぶべきか - 独自ブラウザの GPC 実装 - / gpc-war-story
marcy731
0
56
WebViewの現在地 - SwiftUI時代のWebKit - / The Current State Of WebView
marcy731
0
340
めざせ!WKWebViewマスター! / WKWebView Master
marcy731
4
3.5k
GitHub Copilotのススメ
marcy731
1
1.5k
Introduction to Memory Management in Swift - Swiftのメモリ管理を知る -
marcy731
0
46
ステートマシンを活用したWebView-ネイティブ間連携へのアプローチ / An Approach to WebView-Native Communication Using State Machines
marcy731
1
1.8k
WebViewをNativeのように使いたい / Using-WebView-like-Native-App
marcy731
2
680
「アプリをつくる仕組み」の構築 / build-system-for-STORES-Branded-Apps
marcy731
0
900
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
52k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Google's AI Overviews - The New Search
badams
0
1.6k
Embracing the Ebb and Flow
colly
88
5.2k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
The browser strikes back
jonoalderson
0
1.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Transcript
Voidͱ() - ҙਤΛ͑Δ“Ϣχοτܕ”ͷੈք- STORESגࣜձࣾ ϞόΠϧ։ൃຊ෦ Ϛωʔδϟʔ/iOSΤϯδχΞ ୩ ক࢘ʢ@marcy731ʣ 2025.09.30 νΩνΩʂϞόΠϧLTେձ
ʙॵฤʙ
Void
None
None
None
public typealias Void = ()
Void () ͷܕΤΠϦΞε public typealias Void = ()
()
() : “ۭͷλϓϧ”
() : “Empty Tuple”
Tuple • ෳͷΛͻͱ·ͱΊʹͰ͖Δߏ • ܕͱͯ͠ʮҟͳΔܕΛͻͱͭʹଋͶͨ߹ܕ (product type)ʯ
let tuple1: (Int, String) = (42, “hello") let tuple2: (id:
Int, name: String) = (id: 1, name: "Alice") ཁૉʹॱং͕͋Γɺ0͔ΒͷΠϯσοΫεϥϕϧͰΞΫηεͰ͖Δ Tuple
let tuple1: (Int, String) = (42, “hello") let tuple2: (id:
Int, name: String) = (id: 1, name: "Alice") ϥϕϧΛ͚ΕʮߏମʯͬΆ͘ѻ͑Δ Tuple
0ཁૉλϓϧ: () → ۭλϓϧɺ།Ұͷ͔͠ͳ͍ → Ϣχοτܕ 1ཁૉλϓϧ: ଘࡏ͠ͳ͍ʢ(Int) = Int
ʹ௵ΕΔʣ 2ཁૉҎ্λϓϧ: (A, B, ...) ͱͯ͠ී௨ʹ͑Δ λϓϧͷཁૉ͝ͱͷಛҟੑ
0ཁૉλϓϧ: () → ۭλϓϧɺ།Ұͷ͔͠ͳ͍ → Ϣχοτܕ 1ཁૉλϓϧ: ଘࡏ͠ͳ͍ʢ(Int) = Int
ʹ௵ΕΔʣ 2ཁૉҎ্λϓϧ: (A, B, ...) ͱͯ͠ී௨ʹ͑Δ λϓϧͷཁૉ͝ͱͷಛҟੑ Void
public typealias Void = ()
public typealias Void = () Ϣχοτܕͱͯ͠ͷ ()
ΫϩʔδϟͰͷҙਤදݱ let f: () -> Void = { } let
g: () -> () = { }
ΫϩʔδϟͰͷҙਤදݱ let f: () -> Void = { } let
g: () -> () = { } ܕγεςϜ্·ͬͨ͘ಉ͡ܕɻ ݺͼग़͠ํɾಈ࡞ʹҧ͍ͳ͍ɻ
ΫϩʔδϟͰͷҙਤදݱ let f: () -> Void = { } let
g: () -> () = { } ͰχϡΞϯεҧ͏ɻ
() -> Void let f: () -> Void = {
} • ҙຯ߹͍: ʮ෭࡞༻͚ͩΛߦ͍ɺΓͳ͍ʯ • ϝϦοτ: • ׳शతʹ࠷͘ΘΕ͍ͯΔ • ඪ४ϥΠϒϥϦެࣜυΩϡϝϯτͰͪ͜Β͕جຊ • ʮฦ͢ͳ͍ʯͱ͍͏ҙਤ͕ଈΘΔʢಡΈ͍͢ʣ • ࣮తഎܠ: • νʔϜશମͰಡΜͩͱ͖ʹ Ұ؏ੑ͕͋Δ • ެࣜʹ฿͏ͷ͕ʮSwiftyʯͳॻ͖ํ • ܕͷཪଆʢۭλϓϧͷਖ਼ମʣΛҙࣝ͠ͳͯ͘Α͍ͨΊɺແବʹಡऀΛ໎Θͤͳ͍
() -> () let g: () -> () = {
} • ҙຯ߹͍: ʮۭλϓϧʢ།ҰͷʣΛฦ͢ʯ͜ͱΛ ͋Γͷ··ॻ͍ͨܗ • ϝϦοτ: • ܕཧʹ͍ۙදهͰɺਖ਼͕֬͋͞Δ • σϝϦοτ: • ࣮Ͱ΄ͱΜͲݟ͔͚ͳ͍ → ಡΈख͕ʮͳΜͰͬͪ͜ʹͨ͠ΜͩΖ͏ʁʯͱҰॠ ߟ͑Δ • Ұൠతͳ Swift ίʔυελΠϧ͔Β֎ΕΔ → ʮSwifty ͡Όͳ͍ʯͱײ͡ΒΕ͍͢
APIઃܭͰͷ׆༻ 1. Result<Void, Error> 2. Optional<Void> 3. Reactive / Combine
Result<Void, Error> ʮޭ͕ͩฦ͢ͳ͍ʯ func save(document: Data) async -> Result<Void, SaveError>
{ // ... do work guard hasSpace else { return .failure(.diskFull) } // อଘޭɻฦ͢σʔλແ͍ͷͰ Voidʢʹ()ʣ return .success(()) }
Optional<Void> ʮBool ͩͱԿͷਅِ͔͕ᐆດɻVoid? ྃͱ͍͏ग़དྷࣄΛܕͰදݱʯ private var presented: Void? = nil
func presentIfNeeded() { guard presented == nil else { return } // طʹ࣮ߦࡁΈ presentOnboardingUI() presented = () // ࣮ߦࡁΈͷࠟΛه }
Reactive / Combine ʮ“Πϕϯτ͕ى͖ͨ”͚ͩΛ͑Δʯ final class ViewModel { let didTap
= PassthroughSubject<Void, Never>() // ͳ͠Πϕϯτ func onButtonTap() { didTap.send(()) // Voidܕͷ () ΛૹΔ } }
Neverͱͷରൺ func log() -> Void { } // ݺΜͩΒΔ func
crash() -> Never { fatalError() } // ݺΜͩΒΒͳ͍
ͳͥ () -> () ࣮Ͱ͋·Γݟ͔͚ͳ͍ͷ͔ʁ 1. ՄಡੑॏࢹͷจԽɿ() -> Void ͷํ͕ײత
2. ެࣜAPIɾυΩϡϝϯτͷӨڹɿAppleඪ४ϥΠϒϥϦҰ؏ͯ͠ Void 3. ʮSwiftyʯ͞ͷٻɿSwiftจԽʮಡΈ͢͞ɾ׳शʯΛ༏ઌ 1. () -> Void = Swifty 2. () -> () = ਖ਼͍͚͠ͲҰॠҾ͔͔ͬΔ
·ͱΊ 1. ܕυΩϡϝϯτҎ্ʹ༤ห 1. Void / () ͷ͍͚͕ APIઃܭͰҙਤΛ͑ΔखஈʹͳΔ 2.
Result<Void, Error> Optional<Void> ͰʮແʯܕʹͰ͖Δ 3. Never ͱͷରൺͰʮฦ͞ͳ͍ʯͱʮฦͤͳ͍ʯ͕໌֬ʹ۠ผͰ͖Δ 4. ࣋ͪؼΓ: ʮΓͳ͠ʯΛܰࢹͤͣɺܕͰҙਤΛਖ਼͑͘͠Α͏
ܕϓϩάϥϛϯάྑ͍