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
Mobile Programming Closure 2
Search
yuichiro_takahashi
October 24, 2018
Technology
0
95
Mobile Programming Closure 2
MobileProgrammingの授業のスライドです
yuichiro_takahashi
October 24, 2018
Tweet
Share
More Decks by yuichiro_takahashi
See All by yuichiro_takahashi
App Clip - in a nutshell
yuichirokato
0
310
巨大な機能を VIPER + MicroViewController でいい感じに実装した話
yuichirokato
1
770
Mobile Programming Protocol Extension
yuichirokato
0
77
Mobile Programming Protocol
yuichirokato
0
79
Mobile Programming enum
yuichirokato
0
160
Mobile Programming Optional
yuichirokato
0
130
Mobile Programming Struct
yuichirokato
0
120
Mobile Programming Initializer Beta
yuichirokato
0
120
Mobile Programming Inheritance
yuichirokato
0
140
Other Decks in Technology
See All in Technology
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
100
なぜCodeceptJSを選んだか
goataka
0
160
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
150
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
370
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
630
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
190
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
520
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
ハイテク休憩
sat
PRO
2
130
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
120
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
1
110
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1030
460k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
The Invisible Side of Design
smashingmag
298
50k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Fireside Chat
paigeccino
34
3.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Documentation Writing (for coders)
carmenintech
66
4.5k
Transcript
CLOSUREิ MOBILE PROGRAMMING OCT, 24TH
CLOSUREͱʁ
ςΩετ CLOSUREͱʁ(͓͞Β͍) ▸ ͱͯ͠ѻ͑Δؔ ▸ ແ໊ؔϥϜμࣜɺؔΦϒδΣΫτͱݴΘΕΔ͜ͱ͋ Γ·͢ ▸ ͱͯ͠ѻ͑ΔͷͰؔͷҾʹ͢͜ͱͰ͖Δ͠ ▸
Γͱͯ͠ฦ͢͜ͱͰ͖Δ
ΫϩʔδϟΛѻ͑Δ ͜ͱͰԿ͕خ͍͔͠ʁ
ςΩετ ΫϩʔδϟΛѻ͑Δ͜ͱͰԿ͕خ͍͠ͷ͔ʁ ▸ ॲཧΛநԽͤ͞Δ͜ͱ͕Ͱ͖Δ ▸ ॲཧΛநԽͤ͞Δ͜ͱͰਓؒʹಡΈ͍͢ίʔυʹͳΔ ▸ ࣮͍ͨ͠ॲཧʹϑΥʔΧε͢Δ͜ͱ͕Ͱ͖Δ
Ͳ͏͍͏͜ͱʁ
࢛ଇԋࢉͷྫ
ςΩετ ࢛ଇԋࢉͷྫ ▸ ྫ࢛͑ଇԋࢉͷؔΛ࡞Γ͍ͨͱ͠·͢ ▸ ͠ΫϩʔδϟΛΘͳ͍߹ ▸ ܭࢉͷͨΊͷܕͷҾ͕ೋͭ ▸ ͦΕͱͲͷܭࢉॲཧ(+,
*, -, /)Λ࣮ߦ͢Δ͔Λܾఆ͢ΔͨΊͷ จࣈྻͷҾ͕ҰͭඞཁʹͳΔͱࢥ͍·͢ ▸ ࣮࣍ͷΑ͏ʹͳΓ·͢
ςΩετ ࢛ଇԋࢉͷؔͷྫ func calculate(num1: Int, num2: Int, operator: String) ->
Int { switch operator { case "+": return num1 + num2 case "-": return num1 - num2 case "*": return num1 + num2 case "/": return num1 / num2 default: return num1 + num2 } } calculate(num1: 10, num2: 20, operator: "ˎ")
͜ΕͰ࣮ Ͱ͖͕ͨɾɾɾ
ςΩετ ࣮৭ʑ͕ɾɾɾ func calculate(num1: Int, num2: Int, operator: String) ->
Int { switch operator { case "+": return num1 + num2 case "-": return num1 - num2 case "*": return num1 + num2 case "/": return num1 / num2 default: return num1 + num2 } } calculate(num1: 10, num2: 20, operator: "ˎ") ͍switchΛॻ͔ͳ͍ͱ͍͚ͳ͍(ॲཧͷຊ࣭͡Όͳ͍)
ςΩετ ࣮৭ʑ͕ɾɾɾ func calculate(num1: Int, num2: Int, operator: String) ->
Int { switch operator { case "+": return num1 + num2 case "-": return num1 - num2 case "*": return num1 + num2 case "/": return num1 / num2 default: return num1 + num2 } } calculate(num1: 10, num2: 20, operator: "ˎ") ͍switchΛॻ͔ͳ͍ͱ͍͚ͳ͍(ॲཧͷຊ࣭͡Όͳ͍) ਖ਼͍͠จࣈ͕དྷͳ͔ͬͨ࣌ఆ͠ͳ͍ͱ͍͚ͳ͍(ॲ ཧͷຊ࣭͡Όry)
ςΩετ ࣮৭ʑ͕ɾɾɾ func calculate(num1: Int, num2: Int, operator: String) ->
Int { switch operator { case "+": return num1 + num2 case "-": return num1 - num2 case "*": return num1 + num2 case "/": return num1 / num2 default: return num1 + num2 } } calculate(num1: 10, num2: 20, operator: "ˎ") ͍switchΛॻ͔ͳ͍ͱ͍͚ͳ͍(ॲཧͷຊ࣭͡Όͳ͍) ਖ਼͍͠จࣈ͕དྷͳ͔ͬͨ࣌ఆ͠ͳ͍ͱ͍͚ͳ͍(ॲ ཧͷຊ࣭͡Όry) ͋ΕΕʙ?͓͔͍ͧ͠ʙ?
ςΩετ ࣮৭ʑ͕ɾɾɾ func calculate(num1: Int, num2: Int, operator: String) ->
Int { switch operator { case "+": return num1 + num2 case "-": return num1 - num2 case "*": return num1 + num2 case "/": return num1 / num2 default: return num1 + num2 } } calculate(num1: 10, num2: 20, operator: “ˎ”) ͍switchΛॻ͔ͳ͍ͱ͍͚ͳ͍(ॲཧͷຊ࣭͡Όͳ͍) ਖ਼͍͠จࣈ͕དྷͳ͔ͬͨ࣌ఆ͠ͳ͍ͱ͍͚ͳ͍(ॲ ཧͷຊ࣭͡Όry) ͋ΕΕʙ?͓͔͍ͧ͠ʙ? શ֯จࣈͯ͠ͳ͍ʁ
ςΩετ ࣮৭ʑ͕ɾɾɾ func calculate(num1: Int, num2: Int, operator: String) ->
Int { switch operator { case "+": return num1 + num2 case "-": return num1 - num2 case "*": return num1 + num2 case "/": return num1 / num2 default: return num1 + num2 } } calculate(num1: 10, num2: 20, operator: “ˎ”) ͍switchΛॻ͔ͳ͍ͱ͍͚ͳ͍(ॲཧͷຊ࣭͡Όͳ͍) ਖ਼͍͠จࣈ͕དྷͳ͔ͬͨ࣌ఆ͠ͳ͍ͱ͍͚ͳ͍(ॲ ཧͷຊ࣭͡Όry) ͋ΕΕʙ?͓͔͍ͧ͠ʙ? શ֯͡Όͳ͍ʁ
ςΩετ ৭ʑͳ͕ɾɾɾ ▸ ॲཧΛذͤ͞ΔͨΊʹswitchΛॻ͔ͳ͍ͱ͍͚ͳ͍ ▸ OperatorʹจࣈྻΛ͍ͬͯΔͷͰظ͠ͳ͍จࣈ(=ͱ͔)͕͖ͨ߹ఆ͠ͳ͍ ͱ͍͚ͳ͍(default) ▸ operatorͷจࣈྻͱ࣮ࡍͷܭࢉΛ߹Θͤͳ͍ͱ͍͚ͳ͍ ▸
ԋࢉͷछྨ͕૿͑ͨΒcaseΛ૿͞ͳ͍ͱ͍͚ͳ͍ ▸ ؔΛݺͼग़͢ͱ͖ʹoperatorͷจࣈΛλΠϙ͠ͳ͍Α͏ʹؾΛ͚ͭͳ͍ͱ͍͚ ͳ͍ ▸ ࢛ଇԋࢉͷؔͳͷͰܭࢉͤ͞ΔॲཧʹϑΥʔΧε͍͕ͨͦ͠ΕҎ֎ʹॻ͔ͳ͍ͱ ͍͚ͳ͍͜ͱɺߟ͑ͳ͍ͱ͍͚ͳ͍͜ͱ͕ଟ͍
Ͱ͠ܭࢉͷॲཧ ΛҾͱͯͤͨ͠ Βɾɾɾʁ
ςΩετ ܭࢉͷॲཧΛҾͱͯͤͨ͠Βɾɾɾʁ func calculate(num1: Int, num2: Int, calc: (Int, Int)
-> Int) -> Int { return calc(number1, number2) } // ͠ࢉ calculate(num1: 10, num2: 20) { $0 + $1 } // Ҿ͖ࢉ calculate(num1: 10, num2: 20) { $0 - $1 } // ֻ͚ࢉ calculate(num1: 10, num2: 20) { $0 * $1 } // ׂΓࢉ calculate(num1: 10, num2: 20) { $0 / $1 }
ςΩετ ܭࢉͷॲཧΛҾͱͯͤͨ͠Βɾɾɾʁ func calculate(num1: Int, num2: Int, calc: (Int, Int)
-> Int) -> Int { return calc(number1, number2) } // ͠ࢉ calculate(num1: 10, num2: 20) { $0 + $1 } // Ҿ͖ࢉ calculate(num1: 10, num2: 20) { $0 - $1 } // ֻ͚ࢉ calculate(num1: 10, num2: 20) { $0 * $1 } // ׂΓࢉ calculate(num1: 10, num2: 20) { $0 / $1 } จࣈͷΘΓʹܭࢉॲཧͦͷͷΛ͢Α͏ʹมߋ(typoͷ ৺͕ͳ͘ͳͬͨ)
ςΩετ ܭࢉͷॲཧΛҾͱͯͤͨ͠Βɾɾɾʁ func calculate(num1: Int, num2: Int, calc: (Int, Int)
-> Int) -> Int { return calc(number1, number2) } // ͠ࢉ calculate(num1: 10, num2: 20) { $0 + $1 } // Ҿ͖ࢉ calculate(num1: 10, num2: 20) { $0 - $1 } // ֻ͚ࢉ calculate(num1: 10, num2: 20) { $0 * $1 } // ׂΓࢉ calculate(num1: 10, num2: 20) { $0 / $1 } switchͷྶѹ͕ɾɾɾফ͑ͨɾɾɾʁ(ॲཧ͕γϯϓ ϧʹ) จࣈͷΘΓʹܭࢉॲཧͦͷͷΛ͢Α͏ʹมߋ(typoͷ ৺͕ͳ͘ͳͬͨ)
ςΩετ ܭࢉͷॲཧΛҾͱͯͤͨ͠Βɾɾɾʁ func calculate(num1: Int, num2: Int, calc: (Int, Int)
-> Int) -> Int { return calc(number1, number2) } // ͠ࢉ calculate(num1: 10, num2: 20) { $0 + $1 } // Ҿ͖ࢉ calculate(num1: 10, num2: 20) { $0 - $1 } // ֻ͚ࢉ calculate(num1: 10, num2: 20) { $0 * $1 } // ׂΓࢉ calculate(num1: 10, num2: 20) { $0 / $1 } switchͷྶѹ͕ɾɾɾফ͑ͨɾɾɾʁ(ॲཧ͕γϯϓ ϧʹ) จࣈͷΘΓʹܭࢉॲཧͦͷͷΛ͢Α͏ʹมߋ(typoͷ ৺͕ͳ͘ͳͬͨ) ॲཧΛ͍ͯ͠ΔͷͰߟ ͑Δ͜ͱ͕ݮΔ
ςΩετ ܭࢉͷॲཧΛҾͱͯͤͨ͠Βɾɾɾʁ func calculate(num1: Int, num2: Int, calc: (Int, Int)
-> Int) -> Int { return calc(number1, number2) } // ͠ࢉ calculate(num1: 10, num2: 20) { $0 + $1 } // Ҿ͖ࢉ calculate(num1: 10, num2: 20) { $0 - $1 } // ֻ͚ࢉ calculate(num1: 10, num2: 20) { $0 * $1 } // ׂΓࢉ calculate(num1: 10, num2: 20) { $0 / $1 } // ༨Γ calculate(num1: 10, num2: 20) { $0 % $1 } switchͷྶѹ͕ɾɾɾফ͑ͨɾɾɾʁ(ॲཧ͕γϯϓ ϧʹ) จࣈͷΘΓʹܭࢉॲཧͦͷͷΛ͢Α͏ʹมߋ(typoͷ ৺͕ͳ͘ͳͬͨ) ॲཧΛ͍ͯ͠ΔͷͰߟ ͑Δ͜ͱ͕ݮΔ ॲཧΛ͍ͯ͠ΔͷػೳՃʹΑ ΓॊೈͳରԠ͕Մೳʹ
͏গ͠ݟͯ Έ·͠ΐ͏
BUTTONͷΠϕϯ τϋϯυϥͷྫ
ςΩετ ANDROIDͷϘλϯΛ࣮͢Δ߹ɾɾɾ public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button) } } ·ͣLayoutϑΝΠϧ͔ΒButtonΛऔಘ
ςΩετ ANDROIDͷϘλϯΛ࣮͢Δ߹ɾɾɾ public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button).setOnClickListener(new OnClickListener() { }); } } OnClickListenerΫϥεΛ࡞ͯ͠ɾɾɾ
ςΩετ ANDROIDͷϘλϯΛ࣮͢Δ߹ɾɾɾ public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); } } onClickϝιουΛॻ͍ͯɾɾɾ
ςΩετ ANDROIDͷϘλϯΛ࣮͢Δ߹ɾɾɾ public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d("Sample", "button is tapped!"); } }); } } λοϓ͞Εͨ࣌ͷίʔυΛॻ͘
͜ΕͰ࣮ Ͱ͖͕ͨɾɾɾ
ςΩετ Γ͕ɾɾɾ public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d("Sample", "button is tapped!"); } }); } } λοϓ͞Εͨ࣌ͷॲཧΛॻ͖͍͚ͨͩͳͷʹ࣮·Ͱ͕ԕ͍
ΫϩʔδϟΛ ͤΕɾɾɾ
ςΩετ ΫϩʔδϟΛͤΕɾɾɾ public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button).setOnClickListener { Log.d("Sample", "button is tapped!"); }; } } ຊʹॻ͖͍ͨॲཧ͚ͩʹϑΥʔΧεͰ͖Δʂ
·ͱΊ
ςΩετ ·ͱΊ ▸ ΫϩʔδϟΛ͢͜ͱͰίʔυͷྔ͕ݮΔ ▸ ίʔυͷྔ͕ݮΔͷͰಡΈ͘͢ͳΔ ▸ ༨ܭͳίʔυΛॻ͔ͳͯ͘ࡁΉͷͰॻ͖͍ͨॲཧʹϑΥʔΧ ε͢Δ͜ͱ͕Ͱ͖Δ ▸
ͬͨͶʂͨ͑ͪΌΜʂ
ςΩετ શ෦Ϋϩʔδϟ͞Μͷ͓͔͛