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
Swift: Tuples and Functions
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Antonio Bello
November 16, 2014
Programming
80
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift: Tuples and Functions
SwiftCrunch, Krakow, Nov 16, 2014
Antonio Bello
November 16, 2014
More Decks by Antonio Bello
See All by Antonio Bello
Slices of Swift
jeden
1
77
From Learning to Mastering
jeden
4
160
Other Decks in Programming
See All in Programming
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
200
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
360
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
[2026-10-09]一枚の布で作らなくてもいい。 信頼性は「パッチワーク」で紡がれる~既存の運用と新しい可能性をつなぎ合わせてきたCREの話~
tosite
0
110
ActionController meets Protocol Buffers
sorah
0
680
APNsからLive Activityを開始する話
yumnumm
0
170
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
190
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
190
Simple Storage Service(S3) is not simple
iwatsukayura
0
320
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
34k
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
300
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
3
1.1k
Featured
See All Featured
Leo the Paperboy
mayatellez
10
2.4k
A Modern Web Designer's Workflow
chriscoyier
699
190k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
Designing for Timeless Needs
cassininazir
1
530
From π to Pie charts
rasagy
1
410
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
530
Google's AI Overviews - The New Search
badams
0
1.6k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
610
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
350
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Transcript
Swi$ Tuples'and'Func-ons Antonio&Bello Freelancer Code%Ar(st,%Polyglot%Developer @ant_bello
What's'a'tuple? A"tuple"it's"an"anonymous"struct • it$can$contain$mul,ple$heterogeneous$values • values$can$be$named$or$anonymous
Return'mul*ple'values func quotientAndRemainder(# dividend: Int, # divisor: Int) -> (quotient:
Int, remainder: Int) { let quotient = dividend / divisor return (quotient: quotient, remainder: dividend - divisor * quotient) } let result = quotientAndRemainder( dividend: 59, divisor: 13)
Pass$parameters$to$func/ons$and$ methods func quotientAndRemainder(# dividend: Int, # divisor: Int) ->
(quotient: Int, remainder: Int) { let quotient = dividend / divisor return (quotient: quotient, remainder: dividend - divisor * quotient) } let params = (dividend: 61, divisor: 7) let result = quotientAndRemainder(params)
Func%on'arguments'and'return' values'are'tuples A"func'on"with"no"parameters"takes"an"empty"tuple" ():" func doNothing() {...}
Func%on'arguments'and'return' values'are'tuples A"func'on"returning"Void"actually"returns"an"empty" tuple"(): func doSomething() -> () {...}
Func%on'arguments'and'return' values'are'tuples A"func'on"expec'ng"one"parameter"and"returning"a" single"value"actually: • takes'a'tuple'with'one'value • returns'a'tuple'with'one'value func doSomething(value:
Int) -> (Int) { ... }
Use$Cases
Use$cases Collec&ng)parameters)before) func&on)call Without'tuples ... var dividend = 29 ...
var divisor = 3 ... let result = quotientAndRemainder( dividend: dividend, divisor: divisor)
Use$cases Collec&ng)parameters)before) func&on)call With%tuples var params: (dividend: Int, divisor: Int)
... params.dividend = 29 ... params.divisor = 3 ... let immutableParams = params let result = quotientAndRemainder(immutable)
Important! A"tuple"passed"to"a"func/on"must"be"immutable let immutableParams = params let result = quotientAndRemainder(immutableParams)
Use$cases Buffering)func,on)calls Some%Code...
Thank&You code%@%github/jeden Antonio&Bello @ant_bello