iOS ๐ŸŽ/SwiftUI

TextField keyboardType modifier๋Š” ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ์„ ๋ฐ›๋Š” ํ‚ค๋ณด๋“œ์˜ ํƒ€์ž…์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Œ TextField("ํ…Œ์ŠคํŠธ") .keyboardType(.asciiCapable) ์˜๋ฌธ, ์ˆซ์ž, ํŠน์ˆ˜ ๋ฌธ์ž ์ž…๋ ฅ๋งŒ ๊ฐ€๋Šฅํ•จ (ํ•œ๊ธ€, ์ด๋ชจํ‹ฐ์ฝ˜ ๋ถˆ๊ฐ€ ์•„์Šคํ‚ค๋งŒ ๊ฐ€๋Šฅ) ์ˆซ์ž ๋ฐ ๊ตฌ๋‘์  default๋กœ ์ˆซ์ž์™€ ํŠน์ˆ˜๋ฌธ์ž๊ฐ€ ํ‘œ์‹œ๋˜๋ฉฐ ํ•œ๊ธ€๊ณผ ์˜์–ด ์ž…๋ ฅ ๊ฐ€๋Šฅ ์‚ฌ์šฉ์ž๊ฐ€ URL์„ ์ž…๋ ฅํ•˜๊ธฐ ์‰ฝ๊ฒŒ ํ•˜๋‹จ์— ํŠน์ˆ˜ ๋ฌธ์ž๋ฅผ ์ œ๊ณตํ•จ ์ˆซ์ž๋งŒ ์ž…๋ ฅ ๊ฐ€๋Šฅ ์†Œ์ˆ˜์  ์ž…๋ ฅ์ด ๊ฐ€๋Šฅํ•˜๋„๋ก ์ˆซ์ž์™€ decimal point ์ œ๊ณต ์ˆซ์ž ํ‚ค๋ณด๋“œ์™€ ํœด๋Œ€ํฐ ๋ฒˆํ˜ธ ์ž…๋ ฅ์‹œ ์‚ฌ์šฉ๋˜๋Š” ํŠน์ˆ˜ ๋ฌธ์ž ์ œ๊ณต ์ด๋ฆ„๊ณผ ํœด๋Œ€ํฐ ๋ฒˆํ˜ธ ์ž…๋ ฅ์ด ๊ฐ€๋Šฅํ•˜๋„๋ก ๋‘ ๊ฐ€์ง€ ํ‚ค๋ณด๋“œ๋ฅผ ์ œ๊ณตํ•จ (์ด๋ชจ์ง€, ์˜์–ด ๊ฐ€๋Šฅ) ์ด๋ฉ”์ผ ์ฃผ์†Œ ์ž…๋ ฅ์— ์‚ฌ์šฉ๋˜๋Š” @์™€ . ํŠน์ˆ˜ ๋ฌธ์ž๋ฅผ ํ•˜๋‹จ์— ๋ฐฐ์น˜ํ•œ ํ‚ค๋ณด๋“œ ..
Info.plist contained no UIScene configuration dictionary ํ”„๋กœ์ ํŠธ > Targets > Info.plist > Custom iOS Target Properties > Application Scene Manifest์—์„œ Scene Configuration ์„ ์ถ”๊ฐ€ํ•ด ์ฃผ๋ฉด ๋จ
TextField๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ String ํƒ€์ž…์„ Binding ํ•  ์ˆ˜ ์žˆ์Œ TextField("๊ฐ’์„ ์ž…๋ ฅํ•˜์„ธ์š”", text: ) String์ด ์•„๋‹Œ ํƒ€์ž…์„ Bindingํ•˜๋Š” ๊ฒฝ์šฐ ์—๋Ÿฌ ๋ฐœ์ƒํ•จ. ์ด๋•Œ format์„ ์‚ฌ์šฉํ•˜๋ฉด ํ”„๋กœํผํ‹ฐ์˜ ํƒ€์ž…์„ ๋ฐ”๊ฟ”์ฃผ์ง€ ์•Š๊ณ ๋„ ํ…์ŠคํŠธ ํ•„๋“œ์— ๊ฐ’์„ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Œ ใ„ด checkAmount ๊ฐ’์ด double์ด๊ธฐ ๋•Œ๋ฌธ์— TextField์˜ text ์ธ์ž์— Binding์œผ๋กœ ์ „๋‹ฌํ•˜๋Š” ๊ฒฝ์šฐ ์—๋Ÿฌ ๋ฐœ์ƒํ•จ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Œ TextField( "Proper name", value: $nameComponents, format: .name(style: .medium) ) ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ์œผ๋กœ ๋ถ€ํ„ฐ ์ „๋‹ฌ๋ฐ›์€ ๊ฐ’์„ ์ €์žฅํ•  ํ”„๋กœํผํ‹ฐ๋ฅผ value๋กœ ์ „๋‹ฌํ•˜๊ณ  format ํ˜•์‹์„ format ์ธ์ž๋กœ ์ „๋‹ฌ..
ForEach array, ranges์™€ ํ•จ๊ป˜ ๋ฐ˜๋ณต ์ž‘์—…์„ ํ†ตํ•ด ์—ฌ๋Ÿฌ ๋ทฐ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Œ ํด๋กœ์ ธ๋ฅผ ํ†ตํ•ด ์‹คํ–‰๋˜๋ฉฐ loop์˜ ๋ชจ๋“  ์•„์ดํ…œ์„ ํ•œ๋ฒˆ์”ฉ ์ˆœํ™˜ํ•˜๊ฒŒ ๋จ class test { init() { let titles = ["a", "b", "c", "d", "e"] self.loopAllItems(items: titles) } func loopAllItems(items: [String]) { items.forEach { print($0) } } } ForEach๋Š” ๊ธฐ์กด์— Swift์—์„œ ์‚ฌ์šฉํ•œ ๊ณ ์ฐจ ํ•จ์ˆ˜ forEach์™€ ๋™์ž‘๊ณผ ์‚ฌ์šฉ๋ฒ•์ด ๊ฐ™์Œ ScrollView { ForEach(0 ..< 100) { Text("\($0)") } } ForEach๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋ฐ˜๋ณต๋˜๋Š” ๋ทฐ๋ฅผ ๊ฐ„๋‹จํ•œ ์ฝ”๋“œ๋กœ ํ™”๋ฉด์— ๊ทธ๋ ค ์ค„ ์ˆ˜..
๊ธฐ์กด์— ์‚ฌ์šฉ๋˜๋˜ NavigaitonView๋Š” Deprecated ๋˜๊ณ  NavigationView์™€ ๋™์ผํ•˜๊ฒŒ NavigationStack์„ ์‚ฌ์šฉํ•˜๋ฉด ๋จ home indicator์™€ ์‹œ๊ณ„๋ฅผ ํฌํ•จํ•œ ์ƒ๋‹จ ์˜์—ญ์—๋„ ๋ทฐ๋ฅผ ์œ„์น˜ ์‹œํ‚ฌ ์ˆ˜ ์žˆ์œผ๋‚˜ ์ปจํ…์ธ ๊ฐ€ ๊ฒน์น˜๊ธฐ ๋•Œ๋ฌธ์— ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๊ธฐ์— ๋ถˆํŽธํ•  ์ˆ˜ ์žˆ์Œ SwiftUI๋Š” ์‹œ์Šคํ…œ UI๋‚˜ ๊ธฐ๊ธฐ์˜ ์ฝ”๋„ˆ ์˜์—ญ์„ ํ”ผํ•ด ์ปดํฌ๋„ŒํŠธ๋ฅผ ์œ„์น˜ ์‹œํ‚ฌ ์ˆ˜ ์žˆ์œผ๋‚˜ ์Šคํฌ๋กค ์‹œ ์‹œ์Šคํ…œ ์˜์—ญ์— ๊ฒน์น  ์ˆ˜ ์žˆ์Œ ๋„ค๋น„๊ฒŒ์ด์…˜์„ ์‚ฌ์šฉํ•˜๋ฉด ์ƒ๋‹จ์ด ๋„ค๋น„๊ฒŒ์ด์…˜ ์˜์—ญ์ด ๋˜๋ฏ€๋กœ ์‹œ์Šคํ…œ ์˜์—ญ๊ณผ ์ปจํ…์ธ ๊ฐ€ ๊ฒน์น˜์ง€ ์•Š๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Œ var body: some View { NavigationStack { Form { Section { Text("red") Text("yellow") Text("black") } } .navig..
Form ์• ํ”Œ ๊ณต์‹ ๋ฌธ์„œ ๋ทฐ๋ฅผ ํฌํ•จ ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋Š” Containe Control์„ ๊ทธ๋ฃนํ•‘ ํ•  ์ˆ˜ ์žˆ์Œ. ํŠน์ • ์ปจํŠธ๋กค์— ๋Œ€ํ•ด ์ง€์ •๋œ UI๋ฅผ ๋ณด์—ฌ์คŒ. ์•„๋ž˜ ๊ธ€ ์ฐธ๊ณ  ์ฃผ๋กœ ์„ค์ •ํ™”๋ฉด์ด๋‚˜ ๊ธฐ๋ณธ ์•ฑ์˜ ๋ฆฌ์ŠคํŠธ์—์„œ ์‚ฌ์šฉ๋จ Form ์˜์—ญ ์Šคํฌ๋กค๋ง ๊ฐ€๋Šฅ struct Form where Content : View ์ฝ”๋“œ ์ „์ฒด ๊นƒ ํ—ˆ๋ธŒ ๋งํฌ Group ํผ์€ ์ตœ๋Œ€ 10๊ฐœ์˜ ๋ทฐ๋ฅผ ํฌํ•จ ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— Group ์„ ์‚ฌ์šฉํ•˜๋ฉด ๋” ๋งŽ์€ ๋ทฐ๋ฅผ ํฌํ•จ ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Œ Form { Group { Text("Hello, world! 1") Text("Hello, world! 2") Text("Hello, world! 3") Text("Hello, world! 4") Text("Hello, world! 5") Text("Hello, world..
fram
'iOS ๐ŸŽ/SwiftUI' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (3 Page)