๋ชฉ๋กDESIGN (1)

Focus On Develop ๐ŸคŸ๐ŸคŸ

[Swift] Singleton Pattern (์‹ฑ๊ธ€ํ†ค ํŒจํ„ด)

์˜ค๋žœ๋งŒ์— ํฌ์ŠคํŒ…์„ ํ•˜๋Š” ๊ฒƒ ๊ฐ™๋„ค์š”, ์ด๋Ÿฐ ์ €๋Ÿฐ ์‹ ๊ฒฝ์“ธ ์ผ๋“ค์ด ๋งŽ์•˜๋˜ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ˜‚ ๋ฐ”๋น ๋„ ํ•˜๋ฃจ์— ๊ฐ„๋‹จํ•œ ํฌ์ŠคํŒ…์ด๋ผ๋„ ํ•˜๋‚˜๋Š” ํ•˜์ž๊ณ  ๋ชฉํ‘œ๋ฅผ ์„ธ์› ๋Š”๋ฐ, ์‰ฝ์ง€ ์•Š๋”๊ตฐ์š” ๐Ÿ˜ญ ๊ฑฐ๋‘์ ˆ๋ฏธํ•˜๊ณ  ์˜ค๋Š˜์€ ์‹ฑ๊ธ€ํ†ค ํŒจํ„ด์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณผ๊ฒŒ์š”!! Design Pattern ์‹ฑ๊ธ€ํ†ค ํŒจํ„ด์€ Design Pattern ์ค‘ ์ƒ์„ฑ๊ณผ ๊ด€๋ จ๋œ ๋””์ž์ธ ํŒจํ„ด์ด์—์š”. ๊ทธ๋Ÿผ.. Design Pattern์€ ๋ญ˜๊นŒ์š”? ๊ฐœ๋ฐœ์—์„œ ๋””์ž์ธํŒจํ„ด์ด๋ž€, ๋‹ค์–‘ํ•œ ๊ฐœ๋ฐœํ™˜๊ฒฝ์—์„œ๋„ ๋น„์Šทํ•œ ๋ฌธ์ œ๋“ค์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, ์ด ๋น„์Šทํ•œ ๋ฌธ์ œ๋“ค์„ ํ•ด๊ฒฐํ•˜๋Š” ์ •ํ˜•ํ™”(?)๋œ ํ…œํ”Œ๋ฆฟ์ด๋‚˜ ๊ฐœ๋ฐœํŒจํ„ด ๊ฐ™์€, ๋งˆ์น˜ "ํ•ด๊ฒฐ์ฑ…" ๊ฐ™์€๊ฑฐ์—์š”. ์ด๋Ÿฐ ์–ด๋–ค ํŒจํ„ด์„ ์ ์šฉํ•˜๋ฉด, ๊ทธ๋งŒํผ "์ •ํ˜•ํ™”"๋œ ํ•ด๊ฒฐ์ฑ… ๊ฐ™์€ ๋งฅ๋ฝ์ด๋‹ˆ ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ, ํšจ์œจ์„ฑ, ๋””๋ฒ„๊น…, ํ˜‘์—… ๋“ฑ์ด ์‰ฌ์›Œ์ง€๊ฒ ์ฃ ? Swift์—์„œ ๊ฐ€์žฅ ๋ณดํŽธ์ ์œผ๋กœ ..