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
410
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
720
WWDC26参加レポート ~In Person Labはいいぞ~
kntkymt
1
110
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
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Visualization
eitanlees
153
17k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
590
Agile that works and the tools we love
rasmusluckow
331
22k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
340
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.7k
Automating Front-end Workflow
addyosmani
1370
210k
Product Roadmaps are Hard
iamctodd
55
13k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
780
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Λݟ͚ͭΑ͏ʂ