iOS Yagom Exposition Universelle With Swift

Overview

๐ŸŒŽ ๋งŒ๊ตญ๋ฐ•๋žŒํšŒ ํ”„๋กœ์ ํŠธ

  • ํŒ€ ํ”„๋กœ์ ํŠธ
  • ๊ตฌํ˜„ ๊ธฐ๊ฐ„ : 2021.12.06 ~ 17 (2 weeks)
STEP 1 STEP 2 STEP 3
โœ… โœ… โœ…

๋ชฉ์ฐจ

ํ”„๋กœ์ ํŠธ ์†Œ๊ฐœ

๋งŒ๊ตญ๋ฐ•๋žŒํšŒ์™€ ๊ด€๋ จ๋œ ์„ธ ๊ฐ€์ง€ ํ™”๋ฉด์„ ๊ตฌ์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฒซ ๋ฒˆ์งธ ํ™”๋ฉด์—๋Š” ๋ฐ•๋žŒํšŒ ์ •๋ณด, ๋‘ ๋ฒˆ์งธ ํ™”๋ฉด์—๋Š” ์ถœํ’ˆ์ž‘ ๋ชฉ๋ก, ์„ธ ๋ฒˆ์งธ ํ™”๋ฉด์—๋Š” ํ’ˆ๋ชฉ ์ƒ์„ธ ์„ค๋ช…์œผ๋กœ ๊ตฌ์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

Dynamic Type ์ ์šฉ ์ „ Dynamic Type ์ ์šฉ ํ›„
แ„†แ…กแ†ซแ„€แ…ฎแ†จแ„‡แ…กแ†จแ„…แ…กแ†ทแ„’แ…ฌ1 gilf แ„†แ…กแ†ซแ„€แ…ฎแ†จแ„‡แ…กแ†จแ„…แ…กแ†ทแ„’แ…ฌ2

STEP 1

๐Ÿค” ๊ตฌํ˜„ ๋‚ด์šฉ ๋ฐ ๊ณ ๋ฏผํ•œ ์ 

1. JSON ๋ฐ์ดํ„ฐ๋ฅผ Asset Catalog์— ์ถ”๊ฐ€ํ•˜๊ณ , JSON ๋ฐ์ดํ„ฐ๋ฅผ Decoding ํ•˜๊ธฐ ์œ„ํ•ด ๋งค์นญํ•  Model ํƒ€์ž…์„ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

2. JSON ๋ฐ์ดํ„ฐ ๋ฐ Swift ๊ฐ์ฒด ๊ฐ„์— Encoding ๋ฐ Decoding์„ ํ•˜๊ธฐ ์œ„ํ•ด Codable ํ”„๋กœํ† ์ฝœ์„ ์ฑ„ํƒํ–ˆ์Šต๋‹ˆ๋‹ค.

3. ExpositionItem ํŒŒ์ผ์—์„œ Swift API Guidelines์„ ์ค€์ˆ˜ํ•˜๊ธฐ ์œ„ํ•ด CodingKey ํ”„๋กœํ† ์ฝœ์„ ์ฑ„ํƒํ•˜์—ฌ ์นด๋ฉœ์ผ€์ด์Šค๋กœ ๋ณ€์ˆ˜๋ช…์„ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค. (Ex: image_name -> imageName)

4. Model ํด๋”์˜ Exposition ๋ฐ ExpositionItem ํƒ€์ž…์„ ๊ตฌ์กฐ์ฒด๋กœ ์ง€์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. Swift์—์„œ ์ƒ์† ๋˜๋Š” ์ฐธ์กฐ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, ๊ธฐ๋ณธ์ ์œผ๋กœ ํด๋ž˜์Šค๋ณด๋‹ค๋Š” ๊ตฌ์กฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•  ๊ฒƒ์„ ๊ถŒ์žฅํ•˜๊ณ  ์žˆ๊ณ , ์—ฐ๊ด€๋œ ๊ฐ’์˜ ์ง‘ํ•ฉ์„ ํ‘œํ˜„ํ•  ๋•Œ์—๋„ ๊ตฌ์กฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ ์ ˆํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.

5. ExpositionItemํƒ€์ž…์˜ ๋„ค์ด๋ฐ์„ ํ•  ๋•Œ, ์ฒ˜์Œ์—๋Š” ํ•œ๊ตญ ์ถœํ’ˆ์ž‘์— ์ดˆ์ ์„ ๋งž์ท„์œผ๋‚˜ ์ถ”ํ›„ ํ™•์žฅ์„ฑ์„ ๊ณ ๋ คํ•˜์—ฌ ์ด๋ฅผ ํฌ๊ด„ํ•  ์ˆ˜ ์žˆ๋Š” ExpositionItem์œผ๋กœ ๋„ค์ด๋ฐ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.

6. decode ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•ด์„œ Asset Catalog์— ํŒŒ์ผ์ด ์—†๋Š” ๊ฒฝ์šฐ ์˜ค๋ฅ˜๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š”์ง€, ํŒŒ์ผ์ด ์žˆ๋Š” ๊ฒฝ์šฐ ์˜ค๋ฅ˜๋ฅผ ๋ฐ˜ํ™˜ํ•˜์ง€ ์•Š๊ณ  Decoding์ด ์ž˜ ๋˜๋Š”์ง€ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ— ํ‚ค์›Œ๋“œ

  • JSON, Codable, Data Parsing, NSDataAsset, CodingKey

STEP 2

๐Ÿค” ๊ตฌํ˜„ ๋‚ด์šฉ ๋ฐ ๊ณ ๋ฏผํ•œ ์ 

1. ์˜์กด์„ฑ ์ฃผ์ž…(์ƒ์„ฑ์ž ์ฃผ์ž…)์„ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

ํ™”๋ฉด ๊ฐ„ ๋ฐ์ดํ„ฐ ์ „๋‹ฌ ๋ฐฉ์‹ ์ค‘์—์„œ Notification Center, ํด๋กœ์ €, delegate ํŒจํ„ด, KVC/KVO์€ ๋’ทํ™”๋ฉด์—์„œ ์•žํ™”๋ฉด์œผ๋กœ ์ „ํ™˜ํ•  ๋•Œ ์ ํ•ฉํ•˜๋‹ค๊ณ  ์•Œ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
๋”ฐ๋ผ์„œ ๋‘๋ฒˆ์งธ ํ™”๋ฉด์—์„œ ์„ธ๋ฒˆ์งธ ํ™”๋ฉด์œผ๋กœ์˜ ๋ฐ์ดํ„ฐ ์ „๋‹ฌ์€ ์˜์กด์„ฑ ์ฃผ์ž…์ด ์ ํ•ฉํ•  ๊ฒƒ์œผ๋กœ ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ์ƒ์„ฑ์ž ์ฃผ์ž…, ํ”„๋กœํผํ‹ฐ ์ฃผ์ž…, ๋ฉ”์„œ๋“œ ์ฃผ์ž… ๋ฐฉ์‹ ์ค‘์—์„œ ์ƒ์„ฑ์ž ์ฃผ์ž…์ด ๊ฐ€์žฅ ์ ์ ˆํ•˜๋‹ค๊ณ  ํŒ๋‹จํ•˜์—ฌ ์ ์šฉํ•ด๋ดค์Šต๋‹ˆ๋‹ค.
๊ทธ ์ด์œ ๋Š” ์•„๋ž˜ ๋‹จ์ ์„ ๊ฐ€์ง€๊ณ  ์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

ํ”„๋กœํผํ‹ฐ ์ฃผ์ž… ๋ฉ”์„œ๋“œ ์ฃผ์ž…
๋‹จ์  1. ํ•ด๋‹น ํ”„๋กœํผํ‹ฐ๊ฐ€ ์™ธ๋ถ€์— ๊ณต๊ฐœ๋˜๊ฒŒ ๋œ๋‹ค.
2. ํ•ด๋‹น ํ”„๋กœํผํ‹ฐ์˜ ํƒ€์ž…์ด ์˜ต์…”๋„์ด๊ฑฐ๋‚˜ ๋ถˆํ•„์š”ํ•œ ๊ธฐ๋ณธ๊ฐ’์„ ๊ฐ–๊ฒŒ ๋œ๋‹ค.
ํ•ด๋‹น ํ”„๋กœํผํ‹ฐ์˜ ํƒ€์ž…์ด ์˜ต์…”๋„์ด๊ฑฐ๋‚˜ ๋ถˆํ•„์š”ํ•œ ๊ธฐ๋ณธ๊ฐ’์„ ๊ฐ–๊ฒŒ ๋œ๋‹ค.

2. ํ˜„์—…์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ์Šคํ† ๋ฆฌ๋ณด๋“œ๋ฅผ ํ™”๋ฉด๋งˆ๋‹ค ๋ถ„ํ• ํ•˜์—ฌ ๊ด€๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

3. Model ๋ถ€๋ถ„์—์„œ Foundation ๋Œ€์‹  UIKit์„ import ํ•ด๋„ ๊ดœ์ฐฎ์„์ง€ ๊ณ ๋ฏผํ–ˆ์Šต๋‹ˆ๋‹ค.

JSONParser ์—ด๊ฑฐํ˜•์˜ decode ๋ฉ”์„œ๋“œ์—์„œ NSDataAsset์„ ์ดˆ๊ธฐํ™”ํ•˜๊ธฐ ์œ„ํ•ด UIKit์ด ํ•„์š”ํ–ˆ์Šต๋‹ˆ๋‹ค.

์ผ๋‹จ MVVM ๊ด€์ ์—์„  Model ๋ถ€๋ถ„์— UIKit์„ importํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ๋ฐ”๋žŒ์งํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ JSONParser์˜ ๊ฒฝ์šฐ Model์˜ ๊ธฐ๋Šฅ๋ณด๋‹จ JSON ํŒŒ์ผ์„ ๋‹จ์ˆœํžˆ Parsingํ•˜๋Š” ์—ญํ• ๋งŒ ์ˆ˜ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋‹จ์ˆœํžˆ Util๋กœ ๋ณผ ์ˆ˜ ์žˆ๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ Util๋กœ ํŒŒ์ผ์„ ๋ถ„๋ฆฌํ•˜๊ณ  UIKit์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

4. JSONParser ์—ด๊ฑฐํ˜•์—์„œ Generic์˜ ํƒ€์ž… ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ Item์œผ๋กœ ๋„ค์ด๋ฐํ–ˆ์Šต๋‹ˆ๋‹ค.

์ฒ˜์Œ์—๋Š” exposition ๋ฐ ExpositionItem์˜ ๊ตฌ์กฐ์ฒด ์ธ์Šคํ„ด์Šค๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋‚ด์šฉ์ด๋ฏ€๋กœ Information, ExpoInfo, Data ๋“ฑ์„ ๊ณ ๋ คํ–ˆ๋Š”๋ฐ, Generic์˜ ํƒ€์ž… ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉํ•˜๊ธฐ์— ์–ด์ƒ‰ํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ฒฐ๋ก ์ ์œผ๋กœ JSONParser๊ฐ€ Util์ธ ๋งŒํผ ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๋„ค์ด๋ฐ์ธ Item์œผ๋กœ ๊ฒฐ์ •ํ•˜๋Š” ๊ฒƒ์ด ๋งž๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ’ก ๋ฌธ์ œ์  ๋ฐ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•

1. Codable ํ”„๋กœํ† ์ฝœ์„ ์ฑ„ํƒํ•œ ํƒ€์ž…์˜ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ ๋ฐฉ๋ฒ•

parsing๋œ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ด์•„์ค„ ๋™์ผํ•œ ํƒ€์ž…์˜ ๋นˆ ์ธ์Šคํ„ด์Šค๊ฐ€ ํ•„์š”ํ–ˆ๋Š”๋ฐ, ๊ตฌ์กฐ์ฒด๊ฐ€ Codable์„ ์ฑ„ํƒํ•˜๊ณ  ์žˆ์–ด ๋นˆ ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†์—ˆ์Šต๋‹ˆ๋‹ค. ์ด์— ํ”„๋กœํผํ‹ฐ๋งˆ๋‹ค ๊ธฐ๋ณธ๊ฐ’์„ ์ถ”๊ฐ€ํ•˜์—ฌ ์ดˆ๊ธฐํ™”๋ฅผ ํ–ˆ์Šต๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ ExpositionViewController์—์„œ ์‚ฌ์šฉํ–ˆ๋˜ Exposition๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ, ExpositionItem ๊ตฌ์กฐ์ฒด ํ”„๋กœํผํ‹ฐ์˜ ์ดˆ๊ธฐ๊ฐ’์„ ๋ถ€์—ฌํ–ˆ์„ ๋•Œ ExpositionItemTableViewController์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ œ๋Œ€๋กœ ๊ฐ€์ ธ์˜ค์ง€ ๋ชปํ•˜๊ณ  ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์œ ์ง€๋˜๊ณ  ์žˆ๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ๊ธฐ๋ณธ๊ฐ’์„ ๊ฐ–์ง€ ์•Š๋„๋ก ํ•˜๊ณ  ์˜ต์…”๋„ ํƒ€์ž…์œผ๋กœ ์„ ์–ธํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“ ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜

1. ํ•˜๋“œ ์ฝ”๋”ฉ์„ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด Namespace์™€ ํŒฉํ† ๋ฆฌ ํŒจํ„ด์„ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

ExpositionItemViewController ๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ธฐ์œ„ํ•ด "ExpositionItem" ๊ณผ "expositionItem" ๊ฐ™์€ ์ƒ์ˆ˜๋ฅผ ์•Œ์•„์•ผํ•˜๋Š” ๊ฒƒ์ด ๋ถ€๋‹ด์ด ๋œ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.

์ด๋Š” ์ง์ ‘ String์œผ๋กœ ์ ์–ด์ฃผ์ง€ ์•Š๊ณ  Namespace๋ฅผ ๋”ฐ๋กœ ๋งŒ๋“ค์–ด ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ Factory Pattern์„ ํ™œ์šฉํ•˜์—ฌ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

2. IBOutlet ๋ณ€์ˆ˜๋Š” nil์ด ๋  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์•”์‹œ์  ์ถ”์ถœ ์˜ต์…”๋„(!)์ด ์•„๋‹Œ ์˜ต์…”๋„(?) ํƒ€์ž…์œผ๋กœ ์„ ์–ธํ–ˆ์Šต๋‹ˆ๋‹ค.

์ผ๋‹จ IBOutlet์ด nil์ด ๋  ์ˆ˜ ์žˆ๋Š” ์ƒํ™ฉ์€ ํ•ด๋‹น outlet์ด ์†ํ•ด์žˆ๋Š” ViewController๊ฐ€ ์•„์ง ๋ฉ”๋ชจ๋ฆฌ์— ๋กœ๋“œ๋˜์ง€ ์•Š์•˜๋Š”๋ฐ ์™ธ๋ถ€์—์„œ outlet์— ์ ‘๊ทผํ•˜๋ ค๊ณ  ํ•  ๋•Œ ๋ฐœ์ƒํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ ์ฝ”๋“œ ์ƒ์—์„  IBOutlet์— ์ง์ ‘ ์ ‘๊ทผํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์—†์–ด์„œ nil์ด ๋˜๋Š” ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š์„ ์ˆ˜๋„ ์žˆ์ง€๋งŒ, ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์€ ์–ธ์ œ๋“  ๋ฐ”๋€” ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋ชจ๋“  IBOutlet์„ optional ํƒ€์ž…์œผ๋กœ ํ‘œ์‹œํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

3. ๋ช…ํ™•ํ•˜์ง€ ์•Š์€ ๋„ค์ด๋ฐ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ์กด์— NumberFormatter๋ฅผ ํ™œ์šฉํ•ด .decimal๋กœ formattingํ•œ ๊ฐ’์„ ๋‹ด๋Š” ๋ณ€์ˆ˜๋ฅผ formattedString์œผ๋กœ ๋„ค์ด๋ฐ์„ ํ–ˆ์—ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์–ด๋–ค ๊ฐ’์œผ๋กœ formatting๋˜์—ˆ๋Š”์ง€ ๋ช…ํ™•ํ•˜๊ฒŒ ๋ณด์—ฌ์ฃผ๊ธฐ ์œ„ํ•ด formattedDecimalString๋กœ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ— ํ‚ค์›Œ๋“œ

  • TableView (UITableViewController, Content Configuration), ์˜์กด์„ฑ ์ฃผ์ž… (์ƒ์„ฑ์ž ์ฃผ์ž…), Factory Pattern, ์ฝ”๋“œ๋กœ ํ™”๋ฉด ์ „ํ™˜, ViewController ๊ฐ„์˜ ๋ฐ์ดํ„ฐ ์ „๋‹ฌ, NSCoder, Scroll View, Navigation Controller, Namespace, Utility

STEP 3

๐Ÿค” ๊ตฌํ˜„ ๋‚ด์šฉ ๋ฐ ๊ณ ๋ฏผํ•œ ์ 

1. ๊ธฐ๊ธฐ์˜ ๋ฐฉํ–ฅ์— ๋”ฐ๋ผ ํ™”๋ฉด ๋ฐฉํ–ฅ ์ „ํ™˜์ด ์ž‘๋™ํ•˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

์š”๊ตฌ์‚ฌํ•ญ์— ๋”ฐ๋ผ ์ฒซ ํ™”๋ฉด๋งŒ .portrait์„ ์ง€์›ํ•˜๋„๋ก ํ•˜๊ณ , ๋‚˜๋จธ์ง€ ํ™”๋ฉด์€ ๊ธฐ๊ธฐ์˜ ๋ฐฉํ–ฅ์— ๋งž๊ฒŒ ๋ชจ๋‘ ํ™”๋ฉด ๋ฐฉํ–ฅ ์ „ํ™˜์ด ๋˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

ํ™”๋ฉด ๋ฐฉํ–ฅ ์ „ํ™˜์— ๋Œ€ํ•œ ๊ด€๋ฆฌ๋Š” ๊ฐ๊ฐ์˜ViewController ์—์„œ supportedInterfaceOrientations๋ฅผ ์žฌ์ •์˜ํ•˜์—ฌ ์„ค์ •ํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

2. Larger Accessibility Sizes ์†์„ฑ์— ๋”ฐ๋ผ ๋ ˆ์ด์•„์›ƒ์„ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ๊ธฐ์˜ ํฐํŠธ ํฌ๊ธฐ๊ฐ€ Larger Accessibility Sizes๋ฅผ ํ™œ์„ฑํ™”ํ•˜๊ณ , ํŠน์ • ํฐํŠธ ํฌ๊ธฐ๋ฅผ ๋„˜์–ด์„œ๋Š” ๊ฒฝ์šฐ isAccessibilityCategory๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์ฝ”๋“œ๋ฅผ ๋ถ„๊ธฐํ•˜๊ณ  ๋ ˆ์ด์•„์›ƒ์„ ์žก์•„์ฃผ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค. ํฐํŠธ ํฌ๊ธฐ๊ฐ€ ์ปค์ง€๋Š” ๊ฒฝ์šฐ๋Š” ์Šคํƒ๋ทฐ์˜ axis๋ฅผ .vertical๋กœ ๋ฐ”๊พธ์–ด ๊ณต๊ฐ„์„ ํ™•๋ณดํ–ˆ๊ณ , ์ผ๋ฐ˜์ ์ธ ํฐํŠธ ํฌ๊ธฐ์ผ ๊ฒฝ์šฐ์—๋Š” .horizontal๋กœ ๋‘์–ด ๊ธฐ์กด ํ™”๋ฉด์„ ์œ ์ง€ํ•˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

3. Custom Cell์„ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ์กด์—๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ์ œ๊ณต๋˜๋Š” ์Šคํƒ€์ผ์˜ cell์„ ์‚ฌ์šฉํ–ˆ์—ˆ๋Š”๋ฐ, ์ด๋ฏธ์ง€ ํฌ๊ธฐ ๋“ฑ ์›ํ•˜๋Š” ๋ ˆ์ด์•„์›ƒ์„ ์žก๊ธฐ์— ์–ด๋ ค์›€์ด ์žˆ์–ด์„œ ์ปค์Šคํ…€ ์…€๋กœ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

4. Dynamic Type์„ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ๋ณธ์ ์œผ๋กœ ํ™”๋ฉด์— ๋‚˜ํƒ€๋‚˜๋Š” ์ด๋ฏธ์ง€๋ฅผ ์ œ์™ธํ•œ UI์š”์†Œ๋“ค์— ๋Œ€ํ•ด dynamic type์„ ์ง€์›ํ•˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์•„์ดํฐ ๊ธฐ๋ณธ ์•ฑ(ex. ์„ค์ •)์—์„œ๋„ ๋ณ„๋„๋กœ ์ด๋ฏธ์ง€์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ๋Š˜๋ ค์ฃผ์ง€ ์•Š๋Š” ๊ฒƒ์„ ๋ณด๊ณ , ์ด๋ฏธ์ง€์— ๋Œ€ํ•ด์„œ๋Š” dynamic type์„ ๊ตฌํ˜„ํ•ด์ฃผ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

์—ฌ๋Ÿฌ ๊ฐœ์˜ view controller์—์„œ dynamic type ์ ์šฉ์ด ํ•„์š”ํ–ˆ๊ธฐ์— ๊ฐ UI์š”์†Œ๋ฅผ extensionํ•˜์—ฌ dynamic type์„ ์ ์šฉํ•ด ์ค„ ์ˆ˜ ์žˆ๋Š” ๋ฉ”์„œ๋“œ๋ฅผ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

5. Voice Over๋ฅผ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

Voice Over๋ฅผ ๊ตฌํ˜„ํ•˜๋ฉด์„œ Accessibility Inspector Audit์˜ ๋Œ€์‘์ด ๋ถˆํ•„์š”ํ•˜๋‹ค๊ณ  ์ƒ๊ฐ๋˜๋Š” ์ผ๋ถ€ ๊ฒฝ๊ณ  ๋ฉ”์‹œ์ง€๋ฅผ ๋ฌด์‹œํ–ˆ์Šต๋‹ˆ๋‹ค.

์‹ค์ œ๋กœ Voice Over๋ฅผ Apple Store ๋“ฑ์— ์‚ฌ์šฉํ•ด๋ดค๋”๋‹ˆ, Cell์˜ ์ด๋ฏธ์ง€๋Š” ์ฝ์ง€ ์•Š๊ณ , title ๋ฐ subtitle ๋“ฑ ์ •๋ณด๋ฅผ ๋ฌถ์–ด์„œ button์œผ๋กœ ์ฝ๊ณ , accessoryView๋Š” ์ฝ์–ด์ฃผ์ง€ ์•Š๋Š” ๊ฒƒ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค. ํ™”๋ฉด ์ „ํ™˜ ๋“ฑ์˜ ์ด๋ฒคํŠธ์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์•Œ๋ ค์ฃผ๋Š” ๊ฒƒ์ด Voice Over์˜ ์ฃผ์š” ๋ชฉ์ ์ด๋ผ๊ณ  ํŒ๋‹จํ–ˆ๊ณ  ํ”„๋กœ์ ํŠธ์—๋„ ๋™์ผํ•˜๊ฒŒ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ’ก ๋ฌธ์ œ์  ๋ฐ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•

1. ์‹œ์Šคํ…œ ํฐํŠธ ํฌ๊ธฐ๊ฐ€ ์ปค์ง€๋Š” ๊ฒฝ์šฐ ๋ ˆ์ด์•„์›ƒ์„ ๋ณ€๊ฒฝํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

์šฐ์„  isAccessibilityCategory์˜ ๊ฐ’์„ ๊ธฐ์ค€์œผ๋กœ ์„œ๋กœ ๋‹ค๋ฅธ ๋ ˆ์ด์•„์›ƒ์„ ์ฃผ๊ธฐ ์œ„ํ•ด ๋ถ„๊ธฐํ•˜์˜€์Šต๋‹ˆ๋‹ค. StackView์˜ axis๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๊ธฐ์กด์— ํ•œ ์ค„์— ๋†“์—ฌ์žˆ๋˜ UILabel๋“ค์˜ ํ…์ŠคํŠธ ํฌ๊ธฐ๊ฐ€ ์ปค์ง์— ๋”ฐ๋ผ axis๋ฅผ vertical๋กœ ๋ฐ”๊พธ์–ด ๋‘ ์ค„๋กœ ๋ฐฐ์น˜ํ•˜์—ฌ ๊ธ€์”จ๊ฐ€ ์ž˜๋ฆฌ์ง€ ์•Š๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค. ์‹œ์Šคํ…œ ์„ค์ •์ด ๋ฐ”๋€Œ๋Š” ์•Œ๋ฆผ์„ ๋ฐ›๋Š” ๊ฒƒ์€ NotificationCenter๋ฅผ ํ†ตํ•ด ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

2. ๋‘ ๊ฐœ์˜ ๊ตญ๊ธฐ ์ด๋ฏธ์ง€ ์‚ฌ์ด์— ๋ฒ„ํŠผ์ด ์žˆ์„ ๋•Œ, ์‹œ์Šคํ…œ ํฐํŠธ ํฌ๊ธฐ๊ฐ€ ์ปค์ง€๋ฉด ์ด๋ฏธ์ง€๊ฐ€ ์ž˜๋ฆฌ๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

Dynamic Type์„ ์ง€์›ํ•จ์— ๋”ฐ๋ผ UIButton์˜ ํฌ๊ธฐ๊ฐ€ ์ปค์ง€๊ฒŒ ๋˜์–ด ์–‘ ์˜† ์ด๋ฏธ์ง€๊ฐ€ ์‚ฌ๋ผ์ง€๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์ด์— stack view์˜ distribution๊ณผ content hugging/resistance priority๋ฅผ ์กฐ์ •ํ–ˆ๊ณ , ๋ฒ„ํŠผ๊ณผ ์ด๋ฏธ์ง€์˜ ๋„ˆ๋น„ ๋น„์œจ์„ ๋งž์ถฐ์คŒ์œผ๋กœ์จ ๋ฒ„ํŠผ์ด ํŠน์ • ํฌ๊ธฐ ์ด์ƒ์œผ๋กœ ์ปค์ง€์ง€ ์•Š๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“ ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜

1. Accessibility ์ฝ”๋“œ๋ฅผ ๋ถ„๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

Accessibility์˜ ๊ฒฝ์šฐ ๋ณด์กฐ์ ์ธ ์„ฑ๊ฒฉ์ด ๊ฐ•ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ๋ฉ”์ธ UI ์ฝ”๋“œ์™€ ๋‚˜๋ˆ ์ฃผ๊ธฐ ์œ„ํ•ด ๋ฉ”์„œ๋“œ๋ฅผ ๋ถ„๋ฆฌํ•˜์—ฌ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

2. ์ฝ”๋“œ์˜ ๊ฐ„๊ฒฐ์„ฑ์„ ๊ฐœ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋ฐ˜๋ณต๋˜๋Š” ์ฝ”๋“œ๋“ค์„ ๊ณ ์ฐจํ•จ์ˆ˜๋กœ ํ‘œํ˜„ํ•˜๊ณ , ์ถ•์•ฝํ•  ์ˆ˜ ์žˆ๋Š” ์กฐ๊ฑด๋ฌธ์˜ ๊ฒฝ์šฐ ์‚ผํ•ญ ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์กฐ๊ธˆ ๋” ๊ฐ„๊ฒฐํ•˜๊ฒŒ ํ‘œํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ— ํ‚ค์›Œ๋“œ

  • Accessibility (Voice Over, Dynamic Type, Text Style), Custom Cell, Cell Reuse/Configuration, Stack View, Interface Orientation, Notification Center, AutoLayout
You might also like...
Super powerful remote config utility written in Swift (iOS, watchOS, tvOS, OSX)
Super powerful remote config utility written in Swift (iOS, watchOS, tvOS, OSX)

Mission Control Super powerful remote config utility written in Swift (iOS, watchOS, tvOS, OSX) Brought to you by Have you ever wished you could chang

Parse iOS mobile provisioning files into Swift models

SwiftyProvisioningProfile This library provides a way to decode a .mobileprovision file into a Swift model. Installation The recommended installation

A cross-platform library of Swift utils to ease your iOS | macOS | watchOS | tvOS and Linux development.
A cross-platform library of Swift utils to ease your iOS | macOS | watchOS | tvOS and Linux development.

Mechanica A library of Swift utils to ease your iOS, macOS, watchOS, tvOS and Linux development. Requirements Documentation Installation License Contr

Plans iOS in Swift

Plans-iOS-in-Swift Plans iOS in Swift Plans project, which is a social media app

TypeStyle is a handy app for iPhone and iPad that generates text using different styles and decorations. It is a native Swift iOS app.
TypeStyle is a handy app for iPhone and iPad that generates text using different styles and decorations. It is a native Swift iOS app.

TypeStyle TypeStyle is a handy app for iPhone and iPad that generates text using different styles and decorations. It is a native Swift iOS app. Featu

FancyGradient is a UIView subclass which let's you animate gradients in your iOS app. It is purely written in Swift.
FancyGradient is a UIView subclass which let's you animate gradients in your iOS app. It is purely written in Swift.

FancyGradient is a UIView subclass which let's you animate gradients in your iOS app. It is purely written in Swift. Quickstart Static gradient let fa

Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. (Pure Swift, Supports Linux)

SwiftFoundation Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. Goals Provide a cross-platform in

Owner
chacha
๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป iOS Developer
chacha
IOS-Bootcamp-Examples - Learn to Swift while building apps - With IOS Development Bootcamp

IOS-Bootcamp-Examples Learn to Swift while building apps - With IOS Development

Bilge ร‡akar 9 Dec 21, 2022
Swift-HorizontalPickerView - Customizable horizontal picker view component written in Swift for UIKit/iOS

Horizontal Picker View Customizable horizontal picker view component written in

Afraz Siddiqui 8 Aug 1, 2022
BCSwiftTor - Opinionated pure Swift controller for Tor, including full support for Swift 5.5 and Swift Concurrency

BCSwiftTor Opinionated pure Swift controller for Tor, including full support for

Blockchain Commons, LLC โ€” A โ€œnot-for-profitโ€ benefit corporation 4 Oct 6, 2022
iOS helper library that contains commonly used code in Uptech iOS projects

iOS helper library that contains commonly used code in Uptech iOS projects.

Uptech 1 Apr 1, 2022
SharkUtils is a collection of Swift extensions, handy methods and syntactical sugar that we use within our iOS projects at Gymshark.

SharkUtils is a collection of Swift extensions, handy methods and syntactical sugar that we use within our iOS projects at Gymshark.

Gymshark 1 Jul 6, 2021
Azure Maps iOS SDK binary distribution for Swift Package Manager

Azure Maps Control for iOS Installation In your Xcode iOS Project settings, under Project settingโ€™s Package Dependencies, click on + button to add pac

Microsoft Azure 2 Nov 1, 2021
Personally useful Swift Extensions for iOS Development

Useful-Swift-Extensions Personally useful Swift Extensions for iOS Development; cobbled together from a variety of development projects and StackOverf

Nick Arner 5 Dec 13, 2021
Verify New Zealand COVID Passes in iOS apps using Swift

NzCovidPass-Swift Swift library for verification of the NZ Covid Vaccination Pas

Gallagher Security 4 Jul 19, 2022
Simple and Lightweight App Version Tracking for iOS written in Swift

AEAppVersion Simple and lightweight iOS App Version Tracking written in Swift I made this for personal use, but feel free to use it or contribute. For

Marko Tadiฤ‡ 12 Nov 11, 2022
Easy way to detect iOS device properties, OS versions and work with screen sizes. Powered by Swift.

Easy way to detect device environment: Device model and version Screen resolution Interface orientation iOS version Battery state Environment Helps to

Anatoliy Voropay 582 Dec 25, 2022