๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐ŸŽ ๊ฐœ๋ฐœ/๐Ÿ”ฅ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…14

[Flutter] Uncategorized (Xcode): Command CodeSign failed with a nonzero exit code. ์•ˆ๋…•ํ•˜์‹ญ๋‹ˆ๊นŒ, ๋ฏผํŠธ์ž…๋‹ˆ๋‹ค ๐Ÿ˜ˆํ”Œ๋Ÿฌํ„ฐ ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋Š” ์ค‘ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒผ์Šต๋‹ˆ๋‹ค.Uncategorized (Xcode): Command CodeSign failed with a nonzero exit code.Could not build the application for the simulatorError launching application on iPhone 15 Pro.1. Signing & Capabilities Team์ œ๊ฐ€ ์ฒ˜์Œ๋ถ€ํ„ฐ ๋๊นŒ์ง€ ํ•˜๋Š” ํ”„๋กœ์ ํŠธ๊ฐ€ ์•„๋‹ˆ๋ผ ๋‹ค๋ฅธ ๋ฉ”์ธ ๊ฐœ๋ฐœ์ž ๋ถ„์ด ๊ณ„์‹  ์ƒํƒœ์ด๊ณ , ๊ทธ๋ถ„์ด ๋Œ€๋ถ€๋ถ„์˜ ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜์…จ์Šต๋‹ˆ๋‹ค. ๋•Œ๋ฌธ์— Apple signing & Capabilities์˜ Team ์—ญ์‹œ ๊ทธ๋ถ„์˜ ๊ฒƒ์œผ๋กœ ๋˜์–ด ์žˆ์—ˆ๊ณ , ์ด๋กœ ์ธํ•ด ๋นŒ๋“œ๊ฐ€ ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ๋•Œ๋ฌธ์— ๋กœ์ปฌ์—์„œ ์ž‘์—…ํ•˜๊ณ  .. 2025. 3. 25.
[Flutter] ์›ํ•˜๋Š” ์œ„์น˜๋กœ Scroll ํ•˜๊ธฐ ์•ˆ๋…•ํ•˜์‹ญ๋‹ˆ๊นŒ, ๋ฏผํŠธ์ž…๋‹ˆ๋‹ค ๐Ÿ˜ˆ์ด๋ฒˆ ํฌ์ŠคํŒ…์€ Flutter ์ž‘์—…์„ ํ•˜๋ฉฐ ์žˆ์—ˆ๋˜ ์ผ์ž…๋‹ˆ๋‹ค. Swift์™€ ๋‹ค๋ฅด๊ฒŒ, Flutter๋Š” ํŠน์ • item์œผ๋กœ Scroll์„ ํ•ด์ฃผ๋Š” ๋‚ด์žฅ ํ•จ์ˆ˜๊ฐ€ ์กด์žฌํ•˜์ง€๋Š” ์•Š๋”๋ผ๊ณ ์š”. ๋•Œ๋ฌธ์— ํ•˜๋‚˜์˜ item ๋†’์ด๋ฅผ ๊ณฑํ•œ ์˜คํ”„์…‹์œผ๋กœ Scrollํ•˜๋Š” ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค. ์ด๋•Œ ์•„๋ž˜์™€ ๊ฐ™์€ ๋‘ ๊ฐ€์ง€ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์–ด์š”. ๐Ÿ“š ์ž‘์—…- SalaryCap ์ดˆ๊ณผํ•ด์„œ ๊ตฌ๋งค๊ฐ€ ์•ˆ๋˜๋Š” ์„ ์ˆ˜๋Š” skipํ•˜๊ณ  ์Šคํฌ๋กคํ•ด์„œ ๊ตฌ๋งค ๊ฐ€๋Šฅ ์„ ์ˆ˜๋ถ€ํ„ฐ ๋ณด์—ฌ์ฃผ๊ธฐ1. ๋‹ค์‹œ ๋Œ์•„๊ฐ€๋Š” Scroll๋ชธ๊ฐ’์ด ๋‚ฎ๊ฑฐ๋‚˜ ๊ฐ™์€ ์ฒซ๋ฒˆ์งธ ์„ ์ˆ˜์˜ ์ธ๋ฑ์Šค๋ฅผ ์ฐพ์•„, player item ํ•˜๋‚˜์˜ ๋†’์ด๋ฅผ ๊ณฑํ•œ ์˜คํ”„์…‹์œผ๋กœ scrollํ•˜์˜€์Šต๋‹ˆ๋‹ค. ์ด๋•Œ `shrinkWrap: true`, `NeverScrollableScrollPhysics()`๋กœ ์ธํ•ด ์Šคํฌ.. 2025. 3. 23.
[iOS/Swift] WKWebKit ์•ฝ๊ด€ ์ƒ์„ธ ํŽ˜์ด์ง€ ์ „ํ™˜ํ•˜์—ฌ ๋„์šฐ๊ธฐ ์šฐ๋ฆฌ๋Š” ๋…ธ์…˜ ์›นํŽ˜์ด์ง€๋กœ ๋‘ ๊ฐœ์˜ ์ƒ์„ธ ํŽ˜์ด์ง€๋ฅผ ๋ณด์—ฌ์ค€๋‹ค. ( ํŽ˜์ด์ง€๋Š” ํ˜„์žฌ ์ œ์™ธ๋˜์—ˆ๋‹ค.)๊ฐ™์€ ํ˜•์‹์˜ ๋ทฐ์—, title๊ณผ WebView์˜ ๋งํฌ๋งŒ ๋ฐ”๋€๋‹ค. ๋‹ค๋งŒ ์—ฌ๊ธฐ์„œ ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ, ๋ฐ”๊นฅ์˜ ์•ฝ๊ด€ ์„ ํƒ ํŽ˜์ด์ง€์—์„œ๋„ ํ•ด๋‹น ํ‘œ์‹œ๊ฐ€ ๋ฐ˜์˜๋˜์–ด์•ผ ํ–ˆ๋‹ค. ๊ตฌ์กฐ๋ฅผ ๊ณ ๋ฏผํ•˜๋‹ค๊ฐ€, ์œ„์˜ 3๊ฐœ ํŽ˜์ด์ง€๊ฐ€ ์ „๋ถ€ ๊ฐ™์€ ๋ทฐ๋ชจ๋ธ์„ ๊ณต์œ ํ•˜์—ฌ ์ƒํƒœ ๊ฐ’๋“ค์„ ์ „๋‹ฌ๋ฐ›์„ ์ˆ˜ ์žˆ๋„๋ก ๊ตฌํ˜„ํ–ˆ๋‹ค.WKWebView ์‚ฌ์šฉWebView์˜ ๊ตฌํ˜„ ๋ฐฉ์‹์—์„œ๋Š” 3๊ฐ€์ง€๊ฐ€ ์žˆ๋‹ค. 1. WKWebKit2. open safari3. SFSafariViewController๋‚˜๋Š” ์ด ์ค‘์—์„œ๋„ ๋‹ซ๊ธฐ ๋ฒ„ํŠผ์„ ์ปค์Šคํ…€ํ•˜๊ณ , ๋”ฐ๋กœ ์›น์—์„œ ์ž‘์—…ํ•  ๊ฒƒ ์—†์ด ์•ฑ ๋‚ด์—์„œ ๋ณด์—ฌ์ฃผ๊ธฐ๋งŒ ํ•  ๊ฒƒ์ด๊ธฐ์— WKWebKit์„ ์‚ฌ์šฉํ•˜์˜€๋‹ค. ๋…ธ์…˜์œผ๋กœ ์•ฝ๊ด€์„ ์ •์˜ํ–ˆ๋Š”๋ฐ, ์•ฝ๊ด€์˜ ๋‚ด์šฉ์ด ์ˆ˜์ •๋˜์—ˆ์„ ๋•Œ ๊ตณ.. 2024. 7. 7.
[iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 3. openURL, ์•ฑ์ด suspended์ผ ๋•Œ, query Parameter์— ํ•œ๊ธ€์ด ์žˆ์„ ๋•Œ 2024.07.05 - [iOS/ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…] - [iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 1.์ด๋ฏธ์ง€ URL ์„ค์ • + FileManager์— UIImage ์ €์žฅ [iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 1.์ด๋ฏธ์ง€ URL ์„ค์ • + FileManager์— UIImage ์ €์žฅ์šฐ๋ฆฌ ์„œ๋น„์Šค roome๋Š” ๋ฐฉํƒˆ์ถœ ํ”„๋กœํ•„์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ์ฃผ๋œ ๊ธฐ๋Šฅ์ด๋‹ค. ๋•Œ๋ฌธ์— ์ด ํ”„๋กœํ•„์„ ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ๊ณต์œ ํ•˜๋Š” ๊ฒƒ์ด ํ•„์ˆ˜์˜€๋‹ค. ๋„ค์ด๋ฒ„, ์ธ์Šคํƒ€ ๋“ฑ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ๋งค์ฒด๋ฅผ ๊ณ ๋ฏผํ–ˆ๋Š”๋ฐ ํ”„๋กœํ•„mintraum.tistory.com2024.07.05 - [iOS/ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…] - [iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 2. ์‚ฌ์šฉ์ž ์ •์˜ ํ…œํ”Œ๋ฆฟ ์‚ฌ์šฉ [iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 2. ์‚ฌ์šฉ์ž ์ •์˜ ํ…œํ”Œ๋ฆฟ ์‚ฌ์šฉ2024.07.0.. 2024. 7. 5.
[iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 2. ์‚ฌ์šฉ์ž ์ •์˜ ํ…œํ”Œ๋ฆฟ ์‚ฌ์šฉ 2024.07.05 - [iOS/ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…] - [iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 1.์ด๋ฏธ์ง€ URL ์„ค์ • + FileManager์— UIImage ์ €์žฅ [iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 1.์ด๋ฏธ์ง€ URL ์„ค์ • + FileManager์— UIImage ์ €์žฅ์šฐ๋ฆฌ ์„œ๋น„์Šค roome๋Š” ๋ฐฉํƒˆ์ถœ ํ”„๋กœํ•„์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ์ฃผ๋œ ๊ธฐ๋Šฅ์ด๋‹ค. ๋•Œ๋ฌธ์— ์ด ํ”„๋กœํ•„์„ ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ๊ณต์œ ํ•˜๋Š” ๊ฒƒ์ด ํ•„์ˆ˜์˜€๋‹ค. ๋„ค์ด๋ฒ„, ์ธ์Šคํƒ€ ๋“ฑ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ๋งค์ฒด๋ฅผ ๊ณ ๋ฏผํ–ˆ๋Š”๋ฐ ํ”„๋กœํ•„mintraum.tistory.com์ด์ „๊ธ€์— ์ด์–ด์„œ ๊ณต์œ ํ•˜๊ธฐ ํ…œํ”Œ๋ฆฟ์— ๋Œ€ํ•ด์„œ๋„ ๊ณ ๋ฏผ์ด ์žˆ์—ˆ๋‹ค. ์šฐ๋ฆฌ ํŒ€์€ ๋ณด๋‚ธ ์ด์™€ ๋ฐ›๋Š” ์ด๊ฐ€ ๋‹ค๋ฅด๊ฒŒ ๋ณด์ด๊ธธ ์›ํ–ˆ๋‹ค.์ •ํ™•ํžˆ๋Š” "ํ™•์ธํ•˜๋Ÿฌ ๊ฐ€๊ธฐ" ๋ฒ„ํŠผ์ด ๊ตณ์ด ๋ณธ์ธ์—๊ฒŒ ๋ณด์ผ ํ•„์š”๊ฐ€ ์—†๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๋‹ค. ๋•Œ๋ฌธ์— ์œ„ ์‚ฌ์ง„์ฒ˜๋Ÿผ .. 2024. 7. 5.
[iOS/Swift]์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ ๊ตฌํ˜„ 1.์ด๋ฏธ์ง€ URL ์„ค์ • + FileManager์— UIImage ์ €์žฅ ์šฐ๋ฆฌ ์„œ๋น„์Šค roome๋Š” ๋ฐฉํƒˆ์ถœ ํ”„๋กœํ•„์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ์ฃผ๋œ ๊ธฐ๋Šฅ์ด๋‹ค. ๋•Œ๋ฌธ์— ์ด ํ”„๋กœํ•„์„ ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ๊ณต์œ ํ•˜๋Š” ๊ฒƒ์ด ํ•„์ˆ˜์˜€๋‹ค. ๋„ค์ด๋ฒ„, ์ธ์Šคํƒ€ ๋“ฑ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ๋งค์ฒด๋ฅผ ๊ณ ๋ฏผํ–ˆ๋Š”๋ฐ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋ฅผ ๋ณด์—ฌ์ฃผ๋ฉด์„œ ํด๋ฆญ ์‹œ ์šฐ๋ฆฌ ์•ฑ์œผ๋กœ ์—ฐ๊ฒฐ์„ ํ•˜๋Š” ๊ฒƒ์—๋Š” ์นด์นด์˜ค๋งŒ์ด ์ ํ•ฉํ•˜๋‹ค๋Š” ๊ฒฐ๋ก ์ด ๋‚˜์™€ ์นด์นด์˜คํ†ก ๊ณต์œ ํ•˜๊ธฐ๋งŒ ์‚ฌ์šฉํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค.1. ํ๋ฆ„๊ณต์œ ํ•˜๊ธฐ๊ฐ€ ์ด๋ฃจ์–ด์ง€๋Š” ๊ณผ์ •์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. -----๋ณด๋‚ด๋Š” ์ด-----1. ์‚ฌ์šฉ์ž๊ฐ€ ViewController์—์„œ ๊ณต์œ ํ•˜๊ธฐ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅธ๋‹ค. 2. ViewModel์—์„œ KakaoShareApi๋ฅผ ์‚ฌ์šฉํ•ด ๊ณต์œ ์šฉ ํ…œํ”Œ๋ฆฟ์„ ์ƒ์„ฑํ•˜๊ณ , ์ „๋‹ฌํ•œ๋‹ค. 3. ์ „๋‹ฌ ํ›„ ๋˜๋Œ์•„์˜จ๋‹ค.-----๋ฐ›๋Š” ์ด-----1. ํ™•์ธํ•˜๋Ÿฌ ๊ฐ€๊ธฐ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅธ๋‹ค.2. -1) ์•ฑ ๋ฏธ์„ค์น˜ ์‹œ ์นด์นด์˜ค ๋””๋ฒจ๋กœํผ์Šค์˜ ํ”Œ๋žซํผ์— ์„ค.. 2024. 7. 5.
[iOS/Swift]๋ฒ„ํŠผ์€ ํ•œ ๋ฒˆ๋งŒ ๋ˆŒ๋ €๋Š”๋ฐ View๊ฐ€ ๋‘ ๋ฒˆ ๋ถˆ๋ฆฐ๋‹ค? ์•„์ฃผ ์š”์ƒํ•œ ์ผ์ด ์žˆ์—ˆ๋‹ค. ์ด๋ฏธ์ง€ ์ €์žฅํ•˜๊ธฐ๋ฅผ ๋ˆŒ๋ €๋Š”๋ฐ, ์ €์žฅ ์™„๋ฃŒ ํ˜น์€ ์ €์žฅ ์‹คํŒจ ํŒ์—…์ด ๋‘ ๋ฒˆ ๋ถˆ๋ฆฌ๋Š” ๊ฒŒ ์•„๋‹Œ๊ฐ€?๋กœ์ง์—์„œ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‚˜ ์‹ถ์–ด์„œ ํŒ์—…์„ ํ˜ธ์ถœํ•˜๋Š” ๋ถ€๋ถ„์— ๋ธŒ๋ ˆ์ดํฌ ํฌ์ธํŠธ๋ฅผ ์ฐ์–ด๋ณด์•˜๋Š”๋ฐ, ๋ธŒ๋ ˆ์ดํฌ ํฌ์ธํŠธ๋„ ํ•œ ๋ฒˆ๋งŒ ์žกํ˜”๋‹ค!!์™œ ํŒ์—… ํ˜ธ์ถœ์€ ํ•œ ๋ฒˆ ๋งŒ ๋˜๋Š”๋ฐ ๋ทฐ๋Š” ๋‘๊ฐœ๊ฐ€ ๋ถˆ๋ฆฌ์ง€...? ์ด๊ฑฐ ์—‘์Šค์ฝ”๋“œ ์ž˜๋ชป ์•„๋‹ˆ์•ผ?! ๋ผ๊ณ  ๊ดœํ•œ ํƒ“์„ ํ•ด๋ณด์•˜์ง€๋งŒ.์–ธ์ œ๋‚˜ ์ฝ”๋“œ๋Š” ๊ฑฐ์ง“๋ง์„ ์•ˆํ•˜๋Š”~ ์‘ ๋™์ผํ•œ ๋ทฐ๋ชจ๋ธ ๊ณต์œ ํ•œ ๋‚ด ์ž˜๋ชป~ํ˜„์žฌ ๋‚ด ํ”„๋กœ์ ํŠธ์—๋Š” ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋Š” ์ˆœ๊ฐ„์ด ๋‘ ๋ฒˆ ์กด์žฌํ•œ๋‹ค.1. ์ฒ˜์Œ์— ํ”„๋กœํ•„์„ ๋‹ค ์ƒ์„ฑํ•œ ํ›„ 2. ๋งˆ์ด ํŽ˜์ด์ง€์—์„œ ํ”„๋กœํ•„ ์นด๋“œ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅธ ๊ฒฝ์šฐ๋ทฐ์—๋Š” ์ฐจ์ด๊ฐ€ ์žˆ๊ธฐ์— ๊ฐ๊ธฐ ๋‹ค๋ฅธ ๋ทฐ๋ฅผ ๋งŒ๋“ค๊ณ  ๋ทฐ๋ชจ๋ธ๋งŒ ๊ณต์œ ํ•ด ์คฌ์—ˆ๋Š”๋ฐ, ์ด๋•Œ ๊ฐ์ž ๋‹ค๋ฅธ ๋ทฐ๋ชจ๋ธ์„ ์ƒ์„ฑํ•ด์„œ ๋„ฃ์–ด์ค€ ๊ฒƒ์ด ์•„๋‹ˆ๋ผ DIMa.. 2024. 7. 4.
[iOS/Swift] UIView to UIImage without Display ์š”์ฆ˜ IT ๋™์•„๋ฆฌ ํ”„๋กœ๊ทธ๋ผํ”ผ์—์„œ ์‚ฌ์ด๋“œ ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋Š” ์ค‘์ด๋‹ค. ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋ฅผ ๋งŒ๋“ค์–ด์„œ ๋ณด์—ฌ์ฃผ๋Š” ํ”„๋กœ์ ํŠธ์ธ๋ฐ, 1:1 ์ •๋ฐฉํ–ฅ์˜ ํ”„๋กœํ•„๊ณผ 3:4 ์„ธ๋กœํ˜•์˜ ํ”„๋กœํ•„ ์‚ฌ์ง„ ๊ตฌํ˜„์„ ๋ณด์—ฌ์ฃผ๋ฉด์„œ ๊ณ ๋ฏผ์ด ์ƒ๊ฒผ๋‹ค. ๋””์ž์ธ ์ƒ ์ด๋ฏธ์ง€ ๋ฐ‘์˜ ๋ฒ„ํŠผ์ด ๊ฒน์น˜์ง€ ์•Š๊ธฐ ์œ„ํ•ด 3:4 ์„ธ๋กœํ˜•์˜ height๋ฅผ ๋ฏธ๋ฆฌ ๊ตฌํ˜„ํ•œ ๋’ค ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค์–ด ์ €์žฅํ•˜๊ณ  ๋ณด์—ฌ์ค„ ๋•Œ๋Š” ๊ฐ€๋กœ ๋„“์ด๋ฅผ ์„ธ๋กœ ๊ธธ์ด์— ๋งž์ถ”์–ด ์ค„์ด๋Š” ํ˜•์‹์œผ๋กœ ๊ตฌํ˜„ํ•ด์•ผ ํ–ˆ๋‹ค.๋ฌผ๋ก , ์ด๋ ‡๊ฒŒ ๋ณด์ด๋Š” ๊ฒƒ๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ ์ด๋ฏธ์ง€๋กœ ์ €์žฅํ•˜๊ธฐ๋ฅผ ๋ˆ„๋ฅด๋ฉด 3:4์˜ ๊ฒฝ์šฐ ์˜†์˜ ํšŒ์ƒ‰ ์—†์ด ์นด๋“œ ์ด๋ฏธ์ง€๋งŒ ์ €์žฅ๋˜์–ด์•ผ ํ–ˆ๋‹ค. ๋•Œ๋ฌธ์— view ๊ณ„์ธต์˜ ์ œ์ผ ๋ฐ‘์—์„œ CardView๋ฅผ ๊ทธ๋ฆฌ๊ณ , ํ•ด๋‹น UIView๋ฅผ UIImage๋กœ ์ €์žฅํ•˜์—ฌ ๋ถˆ๋Ÿฌ์™”๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ์ด๋•Œ ์‹œ์ ์˜ ์ฐจ์ด ๋•Œ๋ฌธ์— UIImage๊ฐ€ ๋œจ์ง€ ์•Š์•˜๋‹ค. ๊ณ ๋ฏผํ•˜๋‹ค ์ฒ˜.. 2024. 7. 2.
[iOS] Image url ํ†ตํ•ด ๊ฐ€์ ธ์™€์„œ view์— ๋„์šฐ๊ฑฐ๋‚˜ ๊ฐค๋Ÿฌ๋ฆฌ ๋‹ค์šด๋กœ๋“œํ•˜๋Š” ๋ฐฉ๋ฒ• 2๊ฐ€์ง€ ๋น„๊ต ์ด๋ฒˆ์— unsplash์˜ api๋ฅผ ๋ฐ›์•„์„œ json ๋ฐ์ดํ„ฐ๋ฅผ ํ™•์ธํ•ด๋ณด๋‹ˆ ์‹ ๊ธฐํ•œ ์ ์ด ์žˆ์—ˆ๋‹ค. image๋Š” ๋”ฐ๋กœ url ์ข…๋ฅ˜๋กœ ์ฃผ์–ด์ง€๊ณ , ํ•ด๋‹น url์„ ๋‹ค์‹œ ๋ฐ›์•„์™€์„œ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค๋Š” ๊ฒƒ! ๋•Œ๋ฌธ์— image๋ฅผ ๋‹ค์šด๋กœ๋“œ ํ•˜์—ฌ imageView์— ๋„ฃ์–ด์ฃผ๋Š” protocol์„ ํ•˜๋‚˜ ๋งŒ๋“ค์—ˆ๋‹ค. protocol ImageViewDownloadable { var imageView: UIImageView { get set } } ๊ทธ๋ฆฌ๊ณ  extension์œผ๋กœ ์ด ํ”„๋กœํ† ์ฝœ์„ ์ฑ„ํƒํ•˜๊ณ  ์žˆ๋‹ค๋ฉด image๋ฅผ ๋ณด์—ฌ์ค„ ์ˆ˜๋„ ์žˆ๊ณ , ๊ฐค๋Ÿฌ๋ฆฌ์— ๋‹ค์šด๋ฐ›์„ ์ˆ˜๋„ ์žˆ๋Š” ๋ฉ”์„œ๋“œ๋“ค์„ ๊ฐ๊ฐ ๊ตฌํ˜„ํ•˜์˜€๋‹ค. 1. URLSession.shared.dataTask , @escaping closure ๊ทธ๋ ‡๊ฒŒ ๋งŒ๋“  ์ฒซ ๋ฐฉ๋ฒ•์€ dataTask์˜ @escaping c.. 2024. 2. 14.