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
570
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
570
ゼロから始めるPreferenceの実装 / Let's implement Preferences from scratch
lovee
0
160
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
790
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
APNsからLive Activityを開始する話
yumnumm
0
160
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
200
すこし踏み込む CancellationToken
htkym
2
1.7k
Workers Cache を知る
syumai
0
350
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
140
AWSに止められる覚悟してますか?
morizo_1984
2
520
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
120
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
190
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
510
気持ちぃ〜角丸 Squircle
ryu1013
0
150
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
340
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
100
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
610
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.3k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
860
Deep Space Network (abreviated)
tonyrice
0
360
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Making Projects Easy
brettharned
120
6.8k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
520
Test your architecture with Archunit
thirion
2
2.4k
GitHub's CSS Performance
jonrohan
1033
470k
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