Focus On Develop ๐ŸคŸ๐ŸคŸ

[Swift] Storyboard vs Programmatic UI ๋ณธ๋ฌธ

iOS [Swift]/๊ธฐ์ดˆ๋ฅผ ํƒ„ํƒ„ํžˆ!

[Swift] Storyboard vs Programmatic UI

๋ˆ„๋ฆฌ๋‹ฌ์ดํ‹€ 2021. 2. 5. 15:47

 

์ €๋Š” ์™•์ดˆ๋ณด์ดˆ๋ณด๋ผ์„œ, ๋ฐฐ์šด๋Œ€๋กœ ์ถฉ์‹คํ•˜๊ฒŒ Storyboard๋ฅผ ํ†ตํ•œ UI์ž‘์—…๋งŒ ํ•ด์™”๋Š”๋ฐ์š”~! ๊ณต๋ถ€๋ฅผ ํ•˜๋ฉด ํ• ์ˆ˜๋ก ๋ณต์žกํ•˜๊ฑฐ๋‚˜ ๋‹ค์–‘ํ•œ User Interaction(swipe ๋“ฑ)์ด ํ•„์š”ํ•œ ํ™”๋ฉด๋“ค์„ ๋งŒ๋‚˜๊ฒŒ ๋˜๊ณ , ๊ทธ๊ฒƒ๋“ค์„ ๋” ์ž˜ ๊ตฌํ˜„ํ•˜๋ ค๋ฉด Code Base๋กœ Programaticํ•˜๊ฒŒ UI๋ฅผ ๊ทธ๋ฆด ์ˆ˜๋„ ์žˆ์–ด์•ผ ๊ฒ ๋”๋ผ๊ตฌ์š”!

 

๊ทธ๋ž˜์„œ ์ด๋ฒˆ์—๋Š” CodeBase๋กœ๋„ UI๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์–ด์•ผ ํ•˜๋Š” ์ด์œ ๋ฅผ ํฌ์ŠคํŒ… ํ•ด๋ณผ๊ฑฐ์—์š”!


Storyboard๋กœ ๊ฐœ๋ฐœํ• ๋•Œ ์žฅ/๋‹จ์ 

์žฅ์ 

๊ฒฐ๊ณผ๋ฌผ์— ๊ด€ํ•ด ์˜ˆ์ธกํ•˜๊ธฐ ์‰ฌ์›€ (๋‹น์—ฐํžˆ ๋ˆˆ์œผ๋กœ ๋ณด๋ฉด์„œ ํ™”๋ฉด์„ ๊ทธ๋ฆฌ๋‹ˆ๊นŒ..?)

์†์„ฑ ํ™•์ธ ๊ฐ€๋Šฅ (inspector ํ™”๋ฉด์„ ๋ณด๋ฉด์„œ ํ•˜๋ฉด ํด๋ฆญ ๋”ธ๊น ๋”ธ๊น์œผ๋กœ ๊ฐ„๋‹จํ•˜๊ฒŒ ํ™•์ธ ๊ฐ€๋Šฅํ•˜์ฃ !)

์†Œ์Šค์ฝ”๋“œ๋ฅผ ํ•˜๋‚˜ํ•˜๋‚˜ ๊ธฐ์–ตํ•˜์ง€ ์•Š์•„๋„ ๋ฌด๊ด€

 

๋‹จ์ 

๋ฌด๊ฑฐ์›€ ๐Ÿ˜ฉ (์•„๋งˆ ๋ณต์žกํ•œ ํ™”๋ฉด ์ž‘์—… ํ•˜์‹ค๋•Œ Contraint๋งŒ ์‚ด์ง ๋ฐ”๊ฟ”๋„ ๋ฒ„๋ฒ…๊ฑฐ๋ฆฌ๋Š” ๊ฑฐ ๊ฒฝํ—˜ํ•˜์‹ค ์ˆ˜ ์žˆ์„๊ฑฐ์—์š”..)

IBOutlet ๋งํฌ๊ฐ€ ๋Š์–ด์ง€๋ฉด ์ฐพ๊ธฐ ์–ด๋ ค์›€

์ž‘์€ ํ™”๋ฉด์œผ๋กœ ๊ฐœ๋ฐœ์ด.. ๋ฐ˜์€ Storyboard ๋ณด๋žด, ๋ฐ˜์€ Assistant Editor ๋กœ ์ฝ”๋“œ๋ณด๋žด..๐Ÿ˜‚๐Ÿ˜‚

ํ˜‘์—…์‹œ Git๋“ฑ์„ ํ†ตํ•ด Commitํ•˜๋ฉด, Diff(๋ฐ”๋€ ๋‚ด์šฉ)์„ ๋ด๋„ ๋ชจ๋ฆ„ ใ…‹

ํ˜‘์—…์‹œ Conflict๊ฐ€ ์ž์ฃผ๋‚˜๊ณ , Mergeํ•˜๋Š”๊ฒŒ ์–ด๋ ค์›€

 

 

Programmaticํ•˜๊ฒŒ ๊ฐœ๋ฐœํ• ๋•Œ ์žฅ/๋‹จ์  (์‚ฌ์‹ค์ƒ Storyboard์™€ ๋”ฑ ๋ฐ˜๋Œ€๐Ÿ˜Ž)

์žฅ์ 

ํ”„๋กœ๊ทธ๋žจ์ด ๋ฌด๊ฒ์ง€ ์•Š์Œ

๋ชจ๋‹ˆํ„ฐ ์ „์ฒด๋ฅผ ์ฝ”๋“œ๋กœ ๋ณด๋ฉด์„œ ์ž‘์—…ํ•  ์ˆ˜ ์žˆ์Œ ใ…‹

ํ˜‘์—…์‹œ Conflict๋ฅผ ์ค„์ด๊ณ , Diff๋„ ์‰ฝ๊ฒŒ ์ดํ•ดํ•  ์ˆ˜ ์žˆ์Œ

 

๋‹จ์ 

๊ฐ Component์˜ ์†์„ฑ์„ ์ฝ”๋“œ๋กœ ์ˆ™์ง€ํ•˜๊ณ  ์žˆ์–ด์•ผํ•จ

๊ฒฐ๊ณผ๋ฌผ์„ ์˜ˆ์ธกํ•˜๊ธฐ ์–ด๋ ค์›Œ์„œ ์‹œ๊ฐ์„ฑ์€ ๋–จ์–ด์ง

Code์˜ ๊ธธ์ด๊ฐ€ ๋งค์šฐ๋งค์šฐ ๊ธธ์–ด์ง

 

 

 

๊ทธ๋ž˜์„œ.. ์ €๋Š” Storyboard๋ฅผ ํ†ตํ•œ UI์ž‘์—…์€ ๋งค์šฐ ๊ธฐ๋ณธ์ ์ธ ๊ฒƒ๋“ค(?)์€ ์กฐ๊ธˆ ์ต์ˆ™ํ•ด ์กŒ์œผ๋ฏ€๋กœ, ์ด์   Code Base UI์ž‘์—…์„ ์กฐ๊ธˆ์”ฉ ๊ณต๋ถ€ํ•ด๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค!

 

Comments