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
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う...
Search
Elvis Shi
June 24, 2025
Programming
410
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
Elvis Shi
June 24, 2025
More Decks by Elvis Shi
See All by Elvis Shi
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
580
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
580
ゼロから始めるPreferenceの実装 / Let's implement Preferences from scratch
lovee
0
160
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
800
How did I build an Open-Source SwiftUI Toast Library
lovee
1
190
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
1.3k
SwiftUIで二重スクロール作ってみた / When I tried to make a dual-scroll-ish view in SwiftUI
lovee
1
390
Observation のあれこれ / A brief introduction about Observation
lovee
3
460
ChatGPT 時代の勉強 / Learning under ChatGPT era
lovee
27
9.1k
Other Decks in Programming
See All in Programming
contenteditable と日本語入力に向き合う
colorful12
0
230
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
490
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
1.7k
golang-bob.pdf
iwatsukayura
0
150
パスワード再設定メールのURLについて知っておこう
uyuki234
0
200
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
250
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
140
Next.js: The final boss of Web Performance
guaca
0
370
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
170
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
220
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
310
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
120
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
560
A designer walks into a library…
pauljervisheath
211
25k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
360
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
470
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
300
Building Adaptive Systems
keathley
44
3.3k
Optimising Largest Contentful Paint
csswizardry
37
4k
Crafting Experiences
bethany
1
390
Documentation Writing (for coders)
carmenintech
77
5.6k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
310
New Earth Scene 8
popppiees
4
2.7k
Technical Leadership for Architectural Decision Making
baasie
3
620
Transcript
ࣅͯΔ͚Ͳ৭ʑҧ͏4XJGUͷ༷ forϞόνΩʙ.PCJMF5JQTڞ༗ձʙ ,PUMJOΤϯδχΞૹΔɿ4XJGUҊ݅ʹࢀՃͤ͞ΒΕΔʹඋ͑ͯʙ
} var employedBy = "YUMEMI Inc." var job = "iOS
Developer" var organizerOf = "HAKATA.swift" var favoriteLanguage = "Swift" var twitter = "@lovee" var qiita = "lovee" var github = "el-hoshino" var additionalInfo = """ ࠓ͔Β iPhone ͰϚΠφϯόʔΧʔυ͕ ͑ΔΑ͏ʹͳͬͨΑʂ iOS 26 Developer Beta 2 ϦϦʔεͨ͠Αʂ """ final class Me: Developable, Talkable {
͓͓ɺ,PUMJO׳Εͨํ͕4XJGUॻ͘ͱ͜Μͳͱ͜ΖͰ,PUMJOͷश׳͕ݱΕΔΜͩ Ͷʂ 13ϨϏϡʔʜ ڵຯ͋Δ͔ΒΓ·͢! "OESPJEͱ,.1Ϧιʔε༨༟͋Δ͔Β୭͔J04ʹՃ͢Δਓ͍ͳ͍͔ʁ J04ͷ୲ऀগͳ͍͔Βਐ͕ͪΐͬͱ͍ͳʜ
%JTDMBJNFS w հྫ͕ͯࣗ͢ίʔυϨϏϡʔͷࡍʹग़ձͬͨίʔυͰ͢ ʢΦϦδφϧͰͳ͘ษڧձʹ߹Θͤͨมߋ͋Γʣ w ͦͷͨΊͯ͢Ϗϧυ௨Δ͚Ͳɺ4XJGUతʹ͋·Γ͜͏͠ͳ͍Αɺ ͱ͍͏ࡉ͔͍ͱ͜ΖΛϑΥʔΧεͨ͠ҧ͍Λհ͠·͢ w ·ͨશͯͷҧ͍ΛཏͰ͖ͯΔΘ͚Ͱͳ͍͜ͱΛѱ͔͠Βͣ
if (isUserValid) { // do something } 4XJGUجຊAifAจͷ݅ͰA()Aॻ͔ͳ͍͜ͱ͕ओྲྀͰ͢
if isUserValid { // do something }
enum LoginMethod { case userId case sns } 4XJGUීஈશ෦େจࣈΛ͏ུশ͕DBNFM$BTFʹೖΔ࣌ɺ େจࣈখจࣈΛଗ͑·͢
IUUQTXXXTXJGUPSHEPDVNFOUBUJPOBQJEFTJHOHVJEFMJOFTHFOFSBMDPOWFOUJPOT
enum LoginMethod { case userID case sns } IUUQTXXXTXJGUPSHEPDVNFOUBUJPOBQJEFTJHOHVJEFMJOFTHFOFSBMDPOWFOUJPOT //
શͯେจࣈͷུশͷ߹ var utf8Bytes: [UTF8.CodeUnit] var isRepresentableAsASCII = true var userSMTPServer: SecureSMTPServer // ಄จࣈ͚ͩେจࣈͷུশͷ߹ var radarDetector: RadarScanner var enjoysScubaDiving = true
enum LoginMethod { case userID case sns } func login(method:
LoginMethod) { // do something } login(method: LoginMethod) 4XJGUͷϝιουҾʹϥϕϧΛ༩Ͱ͖·͢ɺ ͦΕʹΑΓݺͼग़͕͠ಡΈ͘͢ͳΔ͜ͱ͕ଟ͍Ͱ͢
enum LoginMethod { case userID case sns } func login(with
method: LoginMethod) { // do something } login(with: LoginMethod)
enum LoginMethod { case userID case sns } func login(with
method: LoginMethod) { // do something } login(with: LoginMethod.userID) 4XJGUܕ͕ਪͰ͖Δ߹ɺ Θ͟Θ͟ܕΛॻ͔ͳͯ͘େৎͰ͢
enum LoginMethod { case userID case sns } func login(with
method: LoginMethod) { // do something } login(with: .userID)
struct ConnectionOption: OptionSet { // ... static let customDnsIpTable: Self
// ... } struct ConnectionOption: OptionSet { // ... static let customDNSipTable: Self // ... } struct ConnectionOption: OptionSet { // ... static let customDNSIPtable: Self // ... } struct ConnectionOption: OptionSet { // ... static let customDNSIPTable: Self // ... } ΫΠζ 4XJGU"1*%FTJHO(VJEFMJOFTʹԊͬͨม໊ʁ
struct ConnectionOption: OptionSet { // ... static let customDnsIpTable: Self
// ... } struct ConnectionOption: OptionSet { // ... static let customDNSipTable: Self // ... } struct ConnectionOption: OptionSet { // ... static let customDNSIPtable: Self // ... } struct ConnectionOption: OptionSet { // ... static let customDNSIPTable: Self // ... } ΫΠζ ͑߹Θͤ
func handle(option: ConnectionOption) { if (option.contains(ConnectionOption.customDNSIPTable)) { // ... }
} ಡΈ͍͢ϥϕϧΛ ͚ͭΒΕΔ ׅހ͕ඞཁͳ͍ ਪͰ͖Δ͔ΒܕཁΒͳ͍ ΫΠζ Լهͷ࣮ΛΑΓ4XJGUΒ͘͢͠Δʹʁ
func handle(_ option: ConnectionOption) { if option.contains(.customDNSIPTable) { // ...
} } ΫΠζ ͑߹Θͤ
func handle(_ option: ConnectionOption) { if option.contains(.customDNSIPTable) { // ...
} } let userOption: ConnectionOption = // ... handle(userOption) ΫΠζ ͑߹Θͤ
ࢀߟࢿྉ w IUUQTXXXTXJGUPSHEPDVNFOUBUJPOBQJEFTJHOHVJEFMJOFT
struct UserData { internal func doSomething() { // ... }
} 4XJGUσϑΥϧτείʔϓ͕JOUFSOBM͔ͩΒ جຊΘ͟Θ͟internal͚ͭΔඞཁͳ͍
struct UserData { func doSomething() { // ... } }
public struct UserData { func doSomething() { // ... }
} QVCMJDએݴͷܕͷதͰಉ͘͡ σϑΥϧτείʔϓJOUFSOBMͰ͢
public struct UserData { // ... } public extension UserData
{ internal func doSomething() { // ... } } །Ұͷྫ֎QVCMJDͳ֦ு͚ͩ σϑΥϧτείʔϓQVCMJDͰ͢ ͕ʜΘ͟Θ͟͜Μͳ͜ͱΔʜʁ
public struct UserData { // ... } extension UserData {
func doSomething() { // ... } } ͜ΕͰ͍͍ΑͶʜʁ
struct UserData { let nickName: String let level: Int }
structͷϓϩύςΟʔ جຊvarએݴͰͳ͍
ʮࢀরܕʯͱʮܕʯ w ʮࢀরܕʯͱɺೖ࣌ʹΠϯελϯεͷࢀরΛίϐʔͯ͠ೖ ͢Δܕͷ͜ͱ w ʮܕʯͱɺೖ࣌ʹΠϯελϯεͷͦͷͷΛίϐʔͯ͠ ೖ͢Δܕͷ͜ͱ w ࢀরܕࢀর͕ڞ༗͞ΕΔͷͰɺೖޙͷͷมߋڞ༗͞ΕΔ w
ܕࢀর͕ڞ༗͞Εͳ͍ͷͰɺೖޙͷͷมߋڞ༗͞Εͳ͍
ࢀরܕͷ߹ " A = SomeThing() ࢀর
ࢀরܕͷ߹ " B = A # ࢀর
ࢀরܕͷ߹ " B.property = new # #ʹର͢Δมߋ͕"ʹ ө͞Εͯ͠·͏ ࢀর
ΠϛϡʔλϒϧΫϥε
ࢀর ࢀরܕʢEBUBDMBTTʣͷ߹ A = SomeThing() " ࢀর
ࢀর ࢀরܕʢEBUBDMBTTʣͷ߹ B = A.copy(property = new) #ʹର͢Δมߋ #ʹཹ·Δ "
ࢀর #
# ܕͷ߹ " A = SomeThing()
# ܕͷ߹ " B = A
ܕͷ߹ " B.property = new # #ʹର͢Δมߋ #ʹཹ·Δ
struct UserData { var nickName: String var level: Int }
struct UserData { var nickName: String var level: Int }
struct UserView: View { @State private var userData: UserData = //... var body: some View { VStack { TextField("Nick Name", text: $userData.nickName) } } } @Stateͷঢ়ଶʹର͠$Ͱ؆୯ʹ ํόΠϯσΟϯά͕࡞ΕΔ
w IUUQT[FOOEFWLPIFSBSUJDMFTTXJGUTUSVDUJNNVUBCJMJUZ w IUUQTRJJUBDPNPNPDIJNFUBSVJUFNTFCDDC ࢀߟࢿྉ
ܕɺΠϛϡʔλϒϧΫϥεͱ΄΅ಉՁ
struct UserData { let id: UUID var nickName: String var
level: Int } ݸਓతྫ֎ มߋ͍ͨ͠໌ࣔతʹΠϯελϯεΛ࠶ੜͯ͠΄͍͠ ϓϩύςΟʔʹ͚ͩletΛ͍·͢
struct UserData { let id: UUID var nickName: String var
level: Int } struct UserView: View { @State private var userData: UserData = // var body: some View { VStack { TextField("Nick Name", text: $userData.nickName) TextField("ID", text: $userData.id) } } } $BOOPUBTTJHOUPQSPQFSUZJEJTBMFUDPOTUBOU
One more thing...
None
4XJGU6*Ͱɺ7JFX.PEFMΛ࡞Βͳ͍͍ͯ͘ w +FUQBDL$PNQPTFͱҧͬͯɺͦͦViewModelجఈΫϥεͷ Α͏ͳͷ༻ҙ͞Ε͍ͯͳ͍ w Ұൠతͳ.77.ͷViewModelɺઃܭͱͯ͠ϥΠϑαΠΫϧ Viewʹґଘ͍ͯ͠Δ͕ɺ4XJGU6*ʹ͓͚ΔViewͨͩͷܕͰ ʮϥΠϑαΠΫϧʯͷ֓೦͢Βͳ͍ w ը໘ͷϥΠϑαΠΫϧ4XJGU6*Τϯδϯ͕ࣗཧ͍ͯ͠Δ͕ɺ
ͦ͜ʹViewModel͕հࡏ͢Δ༨͕ͳ͍ w ͦͦ4XJGU6*ͷViewɺฆΕͳ͘7JFX.PEFMͰ͋Δ w w w w w w w w w w w w w w w w w
4XJGU6*ʹ͓͍ͯɺ ը໘ॲཧViewʹॻ͍ͯΑΖ͍͠ɻ
ࢀߟࢿྉʢफڭઓ૪ʣ w IUUQTYDPNB[BNTIBSQTUBUVT w IUUQTRJJUBDPNLBSBNBHFJUFNTBDDB⒎EFC w IUUQTEFWFMPQFSBQQMFDPNGPSVNTUISFBE
એ IUUQTIBLBUBTXJGUDPOOQBTTDPNFWFOU