Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Elvis Shi
June 24, 2025
Programming
400
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
520
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
530
ゼロから始めるPreferenceの実装 / Let's implement Preferences from scratch
lovee
0
160
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
760
How did I build an Open-Source SwiftUI Toast Library
lovee
1
180
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
450
ChatGPT 時代の勉強 / Learning under ChatGPT era
lovee
27
9k
Other Decks in Programming
See All in Programming
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
110
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
400
実装をデザインガイドラインに追従させるための取り組み / 260731-dip-mosh-design-system
dachi023
0
7.9k
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
590
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
2
410
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
100
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
110
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
660
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
890
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
270
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
370
Featured
See All Featured
技術選定の審美眼(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.3k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
490
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
480
Claude Code のすすめ
schroneko
67
230k
エンジニアに許された特別な時間の終わり
watany
108
250k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
250
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
500
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
500
Google's AI Overviews - The New Search
badams
0
1.6k
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