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
Search
kntk
September 21, 2025
400
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
"奇妙"なSwift
iOSDC2025 day2 LT
kntk
September 21, 2025
More Decks by kntk
See All by kntk
App Intentsのビルドプロセスを支える技術
kntkymt
0
600
WWDC26参加レポート ~In Person Labはいいぞ~
kntkymt
1
100
Swiftのレキシカルスコープ管理
kntkymt
0
330
SwiftのSIMDとその利用方法
kntkymt
2
350
Swiftのオーバーロード選択のスコア規則21種類
kntkymt
0
240
Meet high-performance image filtering in Swift
kntkymt
0
200
プログラミングを始めてからiOSエンジニアになるまで
kntkymt
0
1.8k
SwiftUIでの非同期処理データの状態管理を考える
kntkymt
1
2.6k
大学で出席管理アプリ・掲示板閲覧アプリを開発・運用している学生の話
kntkymt
1
2.8k
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
600
Ruling the World: When Life Gets Gamed
codingconduct
0
410
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
340
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
How to Ace a Technical Interview
jacobian
280
24k
Amusing Abliteration
ianozsvald
1
350
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Transcript
lحົzͳ4XJGU !LOUL J04%$JPTEDB
͡Ίʹ w4XJGUʹଟ͘ͷจ๏ɾݴޠػೳ͕ଘࡏ w໌ࣔతɾײతͰ͋Δ͜ͱʹఆධ
͡Ίʹ w4XJGUʹଟ͘ͷจ๏ɾݴޠػೳ͕ଘࡏ w໌ࣔతɾײతͰ͋Δ͜ͱʹఆධ wͨͩ͠Ԡ༻͢Δͱحົͳίʔυʜ
͡Ίʹ [1, 2][{ _ in }]
ྫ [1, 2][{ _ in }]
ྫ [1, 2][{ _ in }] "SSBZ4MJDF*OU < >
[1, 2][{ _ in }] "SSBZ-JUFSBM ྫจ๏
ྫจ๏ [1, 2][{ _ in }] "SSBZ-JUFSBM 4VCTDSJQU$BMM $MPTVSF
ྫจ๏ [1, 2][{ _ in }] "SSBZ-JUFSBM 4VCTDSJQU$BMM $MPTVSF subscript(_
f: (…) -> Void) -> … {}
ྫจ๏ [1, 2][...] 6OCPVOEFE3BOHF
ྫ3BOHFͱTVCTDSJQU let range: Range<Int> =
let range: Range<Int> = 0..<1 // ..<RangeΛੜ͢Δԋࢉࢠ extension Comparable {
public static func ..< (minimum: Self, maximum: Self) -> Range<Self> {} } ྫ3BOHFͱTVCTDSJQU
ྫ3BOHFͱTVCTDSJQU let range: Range<Int> = 0..<1 print([1, 2][range]) // ArraySlice<Int>([1])
// ..<RangeΛੜ͢Δԋࢉࢠ extension Comparable { public static func ..< (minimum: Self, maximum: Self) -> Range<Self> {} }
ྫ6OCPVOEFE3BOHFͩͱʜ let range: UnboundedRange<Int> = ... print([1, 2][range]) // ArraySlice<Int>([1,
2]) extension Comparable { public static func ... () -> UnboundedRange<Self> {} }
ྫ6OCPVOEFE3BOHFͩͱʜ let range: UnboundedRange<Int> = ... print([1, 2][range]) // ArraySlice<Int>([1,
2]) extension Comparable { public static func ... () -> UnboundedRange<Self> {} 🔴 }
... ྫ6OCPVOEFE3BOHF public typealias UnboundedRange = (UnboundedRange_)->() public enum UnboundedRange_
{ public static postfix func ... (_: UnboundedRange_) -> () { } }
ྫ6OCPVOEFE3BOHF public typealias UnboundedRange = (UnboundedRange_)->() public enum UnboundedRange_ {
public static postfix func ... (_: UnboundedRange_) -> () { } } // ʮ...ʯؔͷࢀরͱͯ͠هड़ [1, 2][...]
ྫ6OCPVOEFE3BOHF public typealias UnboundedRange = (UnboundedRange_)->() public enum UnboundedRange_ {
public static postfix func ... (_: UnboundedRange_) -> () { } } // ʮ...ʯؔͷࢀরͱͯ͠هड़ [1, 2][...] extension Collection { public subscript(x: UnboundedRange) -> SubSequence {} }
ྫ6OCPVOEFE3BOHF public typealias UnboundedRange = (UnboundedRange_)->() public enum UnboundedRange_ {
public static postfix func ... (_: UnboundedRange_) -> () { } } // ΫϩʔδϟʔҾʹೖͬͯ͠·͏ʂ [1, 2][{ _ in }] extension Collection { public subscript(x: UnboundedRange) -> SubSequence {} }
ྫԠ༻ typealias LastIndex = (LastIndex_) -> Void postfix operator ~
enum LastIndex_ { static postfix func ~(_ l: LastIndex_) -> Void {} } extension MutableCollection where Self: BidirectionalCollection { // shorthand of index(before: endIndex) subscript(_ l: LastIndex) -> Element { get { self[index(before: endIndex)] } set { self[index(before: endIndex)] = newValue } } }
ྫԠ༻ typealias LastIndex = (LastIndex_) -> Void postfix operator ~
enum LastIndex_ { static postfix func ~(_ l: LastIndex_) -> Void {} } extension MutableCollection where Self: BidirectionalCollection { // shorthand of index(before: endIndex) subscript(_ l: LastIndex) -> Element { get { self[index(before: endIndex)] } set { self[index(before: endIndex)] = newValue } } } var array = [1, 2, 3] array[~] = 10
ྫ switch Int.random(in: 1..<100) { case { $0.isMultiple(of: 3) }:
print("multiple of 3") case { $0.isMultiple(of: 5) }: print("multiple of 5") default: print("other") } func ~=<T>(evaluate: (T) -> Bool, rhs: T) -> Bool { evaluate(rhs) }
ྫ switch Int.random(in: 1..<100) { case { $0.isMultiple(of: 3) }:
print("multiple of 3") case { $0.isMultiple(of: 5) }: print("multiple of 5") default: print("other") } func ~=<T>(evaluate: (T) -> Bool, rhs: T) -> Bool { evaluate(rhs) }
ྫ switch Int.random(in: 1..<100) { case { $0.isMultiple(of: 3) }:
print("multiple of 3") case { $0.isMultiple(of: 5) }: print("multiple of 5") default: print("other") } func ~=<T>(evaluate: (T) -> Bool, rhs: T) -> Bool { evaluate(rhs) }
ྫύλʔϯϚονϯάԋࢉࢠ switch Int.random(in: 1..<100) { case { $0.isMultiple(of: 3) }:
} switch Int.random(in: 1..<100) { case { $0.isMultiple(of: 3) }: }
ྫύλʔϯϚονϯάԋࢉࢠ switch Int.random(in: 1..<100) { case { $0.isMultiple(of: 3) }:
} { $0.isMultiple(of: 3) } ~= Int.random(in: 1..<100) ίϯύΠϥ෦ͰಡΈସ͑ ˞FOVNͷύλʔϯϚονผ
ྫύλʔϯϚονϯάԋࢉࢠ switch Int.random(in: 1..<100) { case { $0.isMultiple(of: 3) }:
} { $0.isMultiple(of: 3) } ~= Int.random(in: 1..<100) func ~=<T>(evaluate: (T) -> Bool, rhs: T) -> Bool { evaluate(rhs) } ίϯύΠϥ෦ͰಡΈସ͑
ྫԠ༻ extension Set { static func ~=(lhs: Set<Element>, rhs: Element)
-> Bool { lhs.contains(rhs) } }
ྫԠ༻ extension Set { static func ~=(lhs: Set<Element>, rhs: Element)
-> Bool { lhs.contains(rhs) } } let vegitablesIDs: Set<Int> = [1, 2, 3] let fruitsIDs: Set<Int> = [4, 5, 6] func printPlantCategory(plantID: Int) { switch plantID { case vegitablesIDs: print("vegitables") case fruitsIDs: print("fruits") default: print("not vegitables nor fruits") } }
ྫ {String.init}()(“a",5)
ྫ {String.init}()(“a",5) String(”aaaaa”)
ྫจ๏ {String.init}()(“a",5) ؔͷࢀর
ྫจ๏ {String.init}()(“a",5) $MPTVSF 'VODUJPO$BMM ؔͷࢀর
ྫจ๏ {String.init}()(“a",5) ଈ࣮࣌ߦ$MPTVSF ؔͷࢀর
ྫจ๏ {String.init}()(“a",5) 'VODUJPO$BMM ؔͷࢀর ଈ࣮࣌ߦ$MPTVSF
ྫจ๏ {String.init}()(“a",5) ଈ࣮࣌ߦ$MPTVSF
ྫจ๏ String.init(“a",5)
ྫจ๏ String.init(“a",5) 🔴 Missing argument labels 'repeating:count:' in call init(repeating
repeatedValue: String, count: Int)
ྫҾϥϕϧͷআ String.init( repeating: "a", count: 5 )
ྫҾϥϕϧͷআ {String.init}()(“a”,5)
ྫԠ༻
ྫԠ༻
ྫԠ༻ String(repeating:a,count:5) // 28 {String.init}()(a,5) // 20
͓ΘΓ wΈΜͳحົͳ4XJGUΛݟ͚ͭΑ͏ʂ