๋ชฉ๋ก์ „์ฒด ๊ธ€ (454)

Bibi's DevLog ๐Ÿค“๐ŸŽ

[๋ฐฑ์ค€ 6376] e ๊ณ„์‚ฐ (Swift)

6376๋ฒˆ: e ๊ณ„์‚ฐ ์‹œ๊ทธ๋งˆ๋Š” ์•ž ์‹œํ–‰์˜ ๊ฐ’์— ๋”ํ•˜๊ณ , ํŒฉํ† ๋ฆฌ์–ผ์€ ์•ž ์‹œํ–‰์˜ ๊ฐ’์— ๊ณฑํ•˜๋Š” ์‹์œผ๋กœ ๊ตฌํ˜„ํ–ˆ๋‹ค. ํ‹€๋ ธ๋‹ค๊ณ  ๋‚˜์˜ค๋Š” ์ด์œ ๋Š” ๊ฑฐ์˜ ๋Œ€๋ถ€๋ถ„ ์ถœ๋ ฅ ํ˜•์‹ ๋•Œ๋ฌธ์ด์—ˆ๋‹ค. n์ด 0์ผ ๋•Œ, 1์ผ ๋•Œ๋Š” ์ •์ˆ˜ํ˜•์œผ๋กœ ์ถœ๋ ฅ n์ด 2์ผ ๋•Œ๋Š” ์‹ค์ˆ˜ํ˜•์œผ๋กœ ์ถœ๋ ฅ n์ด 3 ์ด์ƒ์ผ ๋•Œ๋Š” ์‹ค์ˆ˜ํ˜•์œผ๋กœ ์ถœ๋ ฅ, ์†Œ์ˆ˜์  9์งธ ์ž๋ฆฌ๊นŒ์ง€ ์ฃผ์˜ - ์†Œ์ˆ˜์  10์งธ ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผํ–ˆ์„ ๋•Œ ๋์ด 0์ด๋ผ๊ณ  ํ•˜๋”๋ผ๋„ 0์„ ์ถœ๋ ฅํ•ด ์ฃผ์–ด์•ผ ํ•œ๋‹ค. ์˜ˆ์‹œ - n์ด 8์ผ ๋•Œ e ๊ฐ’์€ 2.71827876984127 ์ด๊ณ , ์†Œ์ˆ˜์  10์งธ ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผํ–ˆ์„ ๋•Œ ๋์ด 0์ด ๋œ๋‹ค. ๊ทธ๋ž˜๋„ 2.718278770 ์™€ ๊ฐ™์ด 0์„ ๊ฒฐ๊ณผ์— ์ถœ๋ ฅํ•ด ์ฃผ์–ด์•ผ ํ•œ๋‹ค. ์ด ๋ถ€๋ถ„ ๋•Œ๋ฌธ์— ๋ฐ˜์˜ฌ๋ฆผํ•  ๋•Œ round ๋Œ€์‹  String(format:_:) ์„ ์‚ฌ์šฉํ–ˆ๋‹ค. ์ฃผ์˜ - num == 0 ..

[iOS] Coordinator (2) - ์ฝ”๋””๋„ค์ดํ„ฐ ํŒจํ„ด, ์˜ˆ์ œ์™€ ํ•จ๊ป˜ ๊ตฌํ˜„ํ•˜๊ธฐ

โœ”๏ธ ์ด ๊ธ€์˜ ์‹œ๋ฆฌ์ฆˆ๋Š” ์•„๋ž˜์˜ ์„ธ ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•ด ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. Coordinator Pattern How to use the coordinator pattern in iOS apps Advanced coordinators in iOS โœ”๏ธ ์•„๋ž˜์˜ ๋‘ ๋ฌธ์„œ๋Š” ์กฐ์•…ํ•˜๊ฒŒ๋‚˜๋งˆ ๋ฒˆ์—ญ์„ ํ•ด ๋‘์—ˆ์œผ๋‹ˆ ํ˜น์‹œ ํ•„์š”ํ•˜์‹  ๋ถ„ ์ฐธ๊ณ ํ•˜์„ธ์š”. How to use the coordinator pattern in iOS apps ํ•ด์„ ๋ฐ ์ •๋ฆฌ Advanced coordinators in iOS ํ•ด์„ ๋ฐ ์ •๋ฆฌ โœ”๏ธ ์ด์ „ ํŽธ์ธ (1) - ์ฝ”๋””๋„ค์ดํ„ฐ ๊ฐœ๋… ์ดํ•ดํ•˜๊ธฐ๋Š” ์—ฌ๊ธฐ์— ์žˆ์Šต๋‹ˆ๋‹ค. โœ”๏ธ ๋…ธ์…˜์ด ๋” ํŽธํ•˜์‹œ๋‹ค๋ฉด ์—ฌ๊ธฐ์˜ 1,2ํŽธ ํ†ตํ•ฉ๋ณธ ๋ฅผ ํ™•์ธํ•ด ์ฃผ์„ธ์š”. Coordinator ๊ตฌํ˜„ ์ด์ œ ์„ค๋ช…์€ ๋งˆ์น˜๊ณ  ์‹ค์ œ ์ฝ”๋“œ๋ฅผ ๋ณด๋ฉฐ ๊ตฌํ˜„ํ•ด ๋ด…์‹œ๋‹ค. ์˜ˆ์ œ..

๐Ÿ“ฑ๐ŸŽ iOS 2022. 11. 25. 01:13
[iOS] Advanced coordinators in iOS ํ•ด์„ ๋ฐ ์ •๋ฆฌ

Advanced coordinators in iOS iOS ์•ฑ์—์„œ ์ฝ”๋””๋„ค์ดํ„ฐ ํŒจํ„ด์„ ์ ์šฉํ•  ๋•Œ ๋งˆ์ฃผ์น˜๋Š” 6๊ฐ€์ง€ ๋ฌธ์ œ๋“ค์— ๋Œ€ํ•œ ํ•ด๋‹ต์„ ์ฐพ๋Š”๋‹ค. 1. child coordinators๋ฅผ ์–ธ์ œ, ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š”๊ฐ€? ์•ฑ์ด ์ปค์ง€๋ฉด ๋ถ€๋ชจ ์ฝ”๋””๋„ค์ดํ„ฐ์™€ ์ž์‹ ์ฝ”๋””๋„ค์ดํ„ฐ๋ฅผ ๋‘˜ ํ•„์š”๊ฐ€ ์žˆ๋‹ค. ์ž์‹ ์ฝ”๋””๋„ค์ดํ„ฐ๋Š” ๊ฐ๊ฐ ๋‹ค๋ฅธ ๊ธฐ๋Šฅ(์ฑ…์ž„)์„ ๋งก๋Š”๋‹ค ์ž์‹ ์ฝ”๋””๋„ค์ดํ„ฐ ํ•˜๋‚˜์˜ ํ๋ฆ„์ด ๋๋‚ฌ์„ ๋•Œ, ๋ถ€๋ชจ ์ฝ”๋””๋„ค์ดํ„ฐ์—๊ฒŒ ์ด๋ฅผ ์•Œ๋ฆฌ๊ณ , ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ํ๋ฆ„์„ ์ด์–ด์ค€๋‹ค. ๋ณต์žกํ•œ ์•ฑ์˜ ๊ธฐ๋Šฅ์„ ์ž‘๊ฒŒ ๋‚˜๋ˆ„์–ด ์žฌ์‚ฌ์šฉ์ด ์‰ฝ๊ฒŒ ํ•จ child coordinator ์˜ˆ์‹œ class BuyCoordinator: Coordinator { var childCoordinators = [Coordinator]() var navigationController: UI..

๐Ÿ“ฑ๐ŸŽ iOS 2022. 11. 25. 01:08
[iOS] How to use the coordinator pattern in iOS apps ํ•ด์„ ๋ฐ ์ •๋ฆฌ

How to use the coordinator pattern in iOS apps VC๊ฐ€ ์ฝ”๋””๋„ค์ดํ„ฐ๋ฅผ ์†Œ์œ ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์กฐ๊ธˆ ๋” ๊ฐ„๋‹จํ•˜๋‹ค. ์˜์–ด ํ•ด์„๊ณผ ์ฝ”๋“œ ์˜ˆ์ œ ์œ„์ฃผ๋กœ ์ •๋ฆฌ. iOS์•ฑ์—์„œ ์ฝ”๋””๋„ค์ดํ„ฐ ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ• view controller์™€ navigation controller๋ฅผ ๋‹จ์ˆœํ™”ํ•˜๊ธฐ. ์—ฌ๊ธฐ์„œ๋Š” child coordinator ์‚ฌ์šฉ ์ง์ „๊นŒ์ง€ ๋ฐฐ์šด๋‹ค. child coordinator ์‚ฌ์šฉ๋ฒ•์€ ๋‹ค์Œ ๋ฌธ์„œ์—์„œ ๋ฐฐ์šด๋‹ค. iOS ์•ฑ์—์„œ ์ฝ”๋””๋„ค์ดํ„ฐ ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜๋ฉด… View Controller์—์„œ ์•ฑ ํƒ์ƒ‰(app navigation) ์ž‘์—…์„ ์ œ๊ฑฐํ•  ์ˆ˜ ์žˆ๋‹ค. ์šฐ๋ฆฌ๊ฐ€ ํ•„์š”ํ•  ๋•Œ ์•ฑ์˜ ํ๋ฆ„์„ ์กฐ์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ViewController๋“ค์„ ๊ด€๋ฆฌํ•˜๊ณ  ์žฌ์‚ฌ์šฉํ•˜๊ธฐ ๋” ์‰ฌ์›Œ์ง„๋‹ค. massive view c..

๐Ÿ“ฑ๐ŸŽ iOS 2022. 11. 25. 01:06
[๋ฐฑ์ค€ 6359] ๋งŒ์ทจํ•œ ์ƒ๋ฒ” (Swift)

6359๋ฒˆ: ๋งŒ์ทจํ•œ ์ƒ๋ฒ” ์ค‘์ฒฉ ๋ฐ˜๋ณต๋ฌธ์„ ํ—ท๊ฐˆ๋ฆฌ์ง€ ์•Š๊ณ  ์ž˜ ์‚ฌ์šฉํ•˜๋ฉด ํ’€ ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ๋‹ค. n๊ฐœ์˜ ๋ฐฉ์ด ์žˆ๋Š” ๊ฐ์˜ฅ์ด ์ฃผ์–ด์ง„๋‹ค ์ฒ˜์Œ์—” ๋‹น์—ฐํžˆ ๋ชจ๋‘ ์ž ๊ฒจ ์žˆ๋‹ค. ๋งค k๋ฒˆ์งธ ์‹œํ–‰๋งˆ๋‹ค, k์˜ ๋ฐฐ์ˆ˜์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์ด ์—ด๋ ค์žˆ๋‹ค๋ฉด ๋‹ซ๊ณ , ๋‹ซํ˜€ ์žˆ๋‹ค๋ฉด ์—ฐ๋‹ค. n๋ฒˆ์งธ ์‹œํ–‰๊นŒ์ง€ ๋ฐ˜๋ณต ํ›„ ์—ด๋ ค ์žˆ๋Š” ๋ฌธ์˜ ๊ฐฏ์ˆ˜๋ฅผ ์„ธ๋ฉด ๋œ๋‹ค. 5 ≤ n ≤ 100 ์ด๋ฏ€๋กœ ๋ฐ˜๋ณต๋ฌธ์œผ๋กœ๋„ ์ถฉ๋ถ„ํžˆ ํ’€ ์ˆ˜ ์žˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด n=3 ์ด๋ผ ๊ฐ์˜ฅ์— ๋ฐฉ์ด 3๊ฐœ์ผ ๋•Œ, (false, false, false) 1๋ฒˆ์งธ ์‹œํ–‰์—๋Š” 1์˜ ๋ฐฐ์ˆ˜์˜ ๋ฌธ(1, 2, 3..๋ฒˆ์งธ ๋ฌธ)์ด ์—ด๋ ค์žˆ๋‹ค๋ฉด ๋‹ซ๊ณ , ๋‹ซํ˜€ ์žˆ๋‹ค๋ฉด ์—ฐ๋‹ค. (๋งจ ์ฒ˜์Œ์—๋Š” ๋ชจ๋‘ ์ž ๊ฒจ ์žˆ์œผ๋ฏ€๋กœ, ๋ชจ๋‘ ์—ฐ๋‹ค) (true, true, true) 2๋ฒˆ์งธ ์‹œํ–‰์—๋Š” 2์˜ ๋ฐฐ์ˆ˜์˜ ๋ฌธ์ด ์—ด๋ ค์žˆ๋‹ค๋ฉด ๋‹ซ๊ณ , ๋‹ซํ˜€ ์žˆ๋‹ค๋ฉด ์—ฐ๋‹ค. (true..