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

์ „์ฒด ๊ธ€

(102)
[Error, Xcode] iPhone is busy. Preparing debugger support for ~'s iPhone ํ•ด๊ฒฐํ•˜๊ธฐ ERROR - iPhone is busy. Preparing debugger support for ์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ํ•ด๊ฒฐํ•˜๊ธฐ ํฐ์œผ๋กœ ๋นŒ๋“œ๋ฅผ ์‹œ๋„ํ•˜๋˜ ์ค‘ ๊ฐ‘์ž๊ธฐ ๋œฌ ์—๋Ÿฌ!! ๋นŒ๋“œ๋Š” Success์ธ๋ฐ, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์—๋Ÿฌ๋กœ ์‹คํ–‰์ด ์•ˆ ๋˜๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•ด๋ณด์ž......!!!!!!!!! Solution Xcode > Window > Devices and Simulators ํ•˜๋‹จ์˜ + ํด๋ฆญ! Next ํด๋ฆญ! Done ํด๋ฆญ! ๊ทธ๋ฆฌ๋„ ๋‹ค์‹œ ๋นŒ๋“œํ•˜๋ฉด ํ•ธ๋“œํฐ์—์„œ ์ž˜ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค! ์œ„ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์œผ๋กœ ์•ˆ๋˜๋Š” ๊ฒฝ์šฐ, ์•„์ดํฐ ์žฌ์‹œ๋™ํ•˜๋ฉด ๋˜ ์ž˜ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค!๐Ÿ˜Š
[iOS] ํ‚คํŒจ๋“œ๊ฐ€ ํ™œ์„ฑํ™”๋  ๋•Œ TextField ๊ฐ€๋ฆฌ๋Š” ๋ฌธ์ œ ํ•ด๊ฒฐํ•˜๊ธฐ, ํ‚คํŒจ๋“œ ํ•ธ๋“ค๋งํ•˜๊ธฐ ํ‚คํŒจ๋“œ๊ฐ€ ํ™œ์„ฑํ™” ๋˜์–ด ์˜ฌ๋ผ์™”์„ ๋•Œ TextField๊ฐ€ ๊ฐ€๋ ค์ง€๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜์ž ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•๋“ค์ด ์žˆ์ง€๋งŒ, NotificationCenter์„ ์‚ฌ์šฉํ•ด์„œ ํ•ด๊ฒฐํ•ด๋ณด์ž:) ์›ํ•˜๋Š” ๊ณผ์ •์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. PROCESS TextField์„ ํƒ์‹œ ํ‚คํŒจ๋“œ๊ฐ€ ์˜ฌ๋ผ์˜ด (*์•ˆ์˜ฌ๋ผ์˜ค๋Š” ๊ฒฝ์šฐ : Cmd + Shift + k) -> NotificationCenter๋ฅผ ํ†ตํ•ด ํ‚คํŒจ๋“œ๊ฐ€ ์˜ฌ๋ผ์˜ด์„ ์•ฑ์ด ์ธ์ง€ -> ๊ฐ€๋ ค์ง„ TextField๊ฐ€ ๋ณด์ด๋„๋ก ํ™”๋ฉด์ด ์˜ฌ๋ผ๊ฐ -> TextField์— ๊ฐ’ ์ž…๋ ฅ ํ›„ ํ‚คํŒจ๋“œ ๋‚ด๋ฆผ (ํ™”๋ฉด ํ„ฐ์น˜ or Done ํด๋ฆญ) -> ํ‚คํŒจ๋“œ๊ฐ€ ๋‚ด๋ ค๊ฐ์„ NotificationCenter๋ฅผ ํ†ตํ•ด ์•ฑ์ด ์ธ์ง€ -> ํ™”๋ฉด ์›์ƒ๋ณต๊ท€ 1. NotificationCenter - Observer ๋“ฑ๋ก ํ‚คํŒจ๋“œ๊ฐ€ ํ™œ์„ฑํ™” ๋˜๋Š”์ง€ ์•ˆ๋˜๋Š”์ง€ ํƒ์ง€ํ•  ..
[iOS] ์•Œ๊ณ ๋ฆฌ์ฆ˜, ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ค€๋น„ํ•˜๊ธฐ - Command Line Tool, LeadLine, Split, Components, map, print ์‚ฌ์šฉํ•˜๊ธฐ Swift๋กœ ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ ์ค€๋น„, ์„ธํŒ…ํ•˜๊ธฐ Swift ์ž…๋ ฅํ•˜๊ธฐ Swift๋กœ ์ฝ”ํ…Œ๋ฅผ ์ค€๋น„ํ•˜๋ ค๊ณ  ํ•˜๋‹ˆ! ์–ด๋–ป๊ฒŒ ์ž…๋ ฅ์„ ๋ฐ›์•„์„œ ์ฒ˜๋ฆฌํ•˜์ง€...? Swift๋กœ ์ž…๋ ฅ์„ ๋ฐ›๊ธฐ ์œ„ํ•ด์„  project ์ƒ์„ฑ์‹œ, playground, app์ด ์•„๋‹Œ ์ƒˆ๋กœ์šด ํƒฌํ”Œ๋ฆฟ์„ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค! ์ฝ”ํ…Œ๋ฅผ ์œ„ํ•œ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ๋ฒ•, Swift์—์„œ ์ž…์ถœ๋ ฅ๋ฐ›๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ๋ ค๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค! ๐Ÿ‘ป 1. ํ”„๋กœ์ ํŠธ ๋งŒ๋“ค๊ธฐ ๋จผ์ €, playground๋Š” sandbox์ด๊ธฐ ๋•Œ๋ฌธ์— commandline input์— ์ ‘๊ทผํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! (*์ƒŒ๋“œ๋ฐ•์Šค(sandbox) : ์™ธ๋ถ€๋กœ๋ถ€ํ„ฐ ๋“ค์–ด์˜จ ํ”„๋กœ๊ทธ๋žจ์ด ๋ณดํ˜ธ๋œ ์˜์—ญ์—์„œ ๋™์ž‘ํ•ด ์‹œ์Šคํ…œ์ด ๋ถ€์ •ํ•˜๊ฒŒ ์กฐ์ž‘๋˜๋Š” ๊ฒƒ์„ ๋ง‰๋Š” ๋ณด์•ˆ ํ˜•ํƒœ) ๋”ฐ๋ผ์„œ, project๋ฅผ ์ƒ์„ฑ ์‹œ ํ…œํ”Œ๋ฆฟ์„ Command Line Tool๋กœ ์„ ํƒํ•˜์—ฌ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค! xc..
[Error, Xcode] Multiple commands produce Error ํ•ด๊ฒฐํ•˜๊ธฐ Multiple commands produce Error ํ•ด๊ฒฐํ•ด ๋ณด์ž ์œ„ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์ด Multiple commands produce Error ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๊ฒฝ์šฐ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค.๐Ÿ˜Š ์ €์˜ ๊ฒฝ์šฐ ๋ณดํ†ต ์™ธ๋ถ€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํฌํ•จํ•œ ํ”„๋กœ์ ํŠธ๋ฅผ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์•˜์„ ๋•Œ ๋งŒ๋‚ฌ๋˜ ์—๋Ÿฌ์ž…๋‹ˆ๋‹ค. ์ค‘๋ณต๋œ ํŒŒ์ผ๋ช…์ด ์žˆ๊ฑฐ๋‚˜, ์ค‘๋ณต๋œ ํƒ€๊ฒŸ์ด ์žˆ์–ด์„œ ์ถฉ๋Œ๋กœ ์ธํ•œ ์—๋Ÿฌ์ž…๋‹ˆ๋‹ค.๐Ÿ‘ป ์—๋Ÿฌ ๋‚ด์šฉ์ด ์นœ์ ˆํ•˜๊ฒŒ ๋ช…์‹œ๋˜์–ด ์žˆ์–ด์„œ ๊ฐ„๋‹จํ•ด ๋ณด์ด์ง€๋งŒ ์•ˆ๋˜๋Š” ๊ฒฝ์šฐ๋„ ์žˆ์–ด์„œ ์ €๋Š” ์ค‘๋ณต๋œ ํŒŒ์ผ๊ณผ ์ค‘๋ณต๋œ ํƒ€๊ฒŸ 2๊ฐ€์ง€๋ฅผ ์ฒดํฌํ•˜์—ฌ ํ•ด๊ฒฐํ•˜์˜€์–ด์š”. Solution1. ํ•ด๋‹น ๋กœ๊ทธ์— ๋ช…์‹œ๋œ ๊ฒฝ๋กœ์˜ ํŒŒ์ผ ์‚ญ์ œ ํŒŒ์ผ์ด ์ค‘๋ณต๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜์—ฌ ์ค‘๋ณต๋œ ํŒŒ์ผ์„ ์‚ญ์ œํ•ด์ค๋‹ˆ๋‹ค. Project > Targets > Build Phases > Copy Bundle Resources ํ•ด๋‹น ..
[Swift] String(describing:) ์‚ฌ์šฉํ•˜์—ฌ ํ˜„์žฌ ํด๋ž˜์Šค ์ด๋ฆ„ ์–ป๊ธฐ String(describing:) ๋ฉ”์†Œ๋“œ ์‚ฌ์šฉํ•˜์—ฌ float String, ํ˜„์žฌ ํด๋ž˜์Šค ์ด๋ฆ„ ๋ฐ›๊ธฐ Declaration init(describing instance: Subject) Swift์—์„œ ๊ฐ’์œผ๋กœ๋ถ€ํ„ฐ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์€ String( )์œผ๋กœ ํŠน์ • ๊ฐ’์„ ๊ฐ์‹ธ์„œ ๋ฌธ์ž์—ด(String)๋กœ ๋งŒ๋“ญ๋‹ˆ๋‹ค. Swift์˜ ๊ธฐ๋ณธ ํƒ€์ž…๋“ค์€ ๋ชจ๋‘ ์ด ๋ณ€ํ™˜์ด ๊ฐ€๋Šฅํ•˜๋ฉฐ, (์‚ฌ์‹ค ์ธํ„ฐํด๋ ˆ์ด์…˜์ด ๊ฐ€๋Šฅํ•œ ํƒ€์ž…๋“ค์€ ๋‹ค ๋œ๋‹ค๊ณ  ๋ณด๋ฉด ๋œ๋‹ค.) ๊ทธ ์™ธ์— ์ด๋ฅผ ํ†ตํ•œ ์ง๋ณ€ํ™˜์ด ๋ถˆ๊ฐ€๋Šฅํ•œ ํƒ€์ž…๋“ค์€ String(describing:)์„ ์ด์šฉํ•ด์„œ ๋ณ€ํ™˜ํ•˜๋ฉด ๋œ๋‹ค. Float -> String let stringValue = String(describing: floatValue) ๋ฐ˜๋Œ€๋กœ String -> Float let floatValue = CGFl..
[iOS] respondsToSelector, ์˜ต์…”๋„ ์ฒด์ด๋‹ ์‚ฌ์šฉํ•˜์—ฌ ๋ธ๋ฆฌ๊ฒŒ์ดํŠธ์˜ ์„ ํƒ์  ๋ฉ”์†Œ๋“œ(optional method) ๊ตฌํ˜„ ์—ฌ๋ถ€ ํ™•์ธํ•˜๊ธฐ (in Swift, Objective-C) ๋ธ๋ฆฌ๊ฒŒ์ดํŠธ์˜ ์„ ํƒ์  ๋ฉ”์†Œ๋“œ(optional method) ๊ตฌํ˜„ ์—ฌ๋ถ€ ํ™•์ธํ•ด๋ณด์ž Swift์™€ Objc์˜ ํ”„๋กœํ† ์ฝœ์—์„œ ๋ฉ”์†Œ๋“œ๋Š” ํ•„์ˆ˜, ์„ ํƒ์  ๋ฉ”์†Œ๋“œ๋กœ ๊ตฌํ˜„ ๊ฐ€๋Šฅํ•˜๋‹ค. ์„ ํƒ์  ๋ฉ”์†Œ๋“œ(optional method)๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์ „, ๋ธ๋ฆฌ๊ฒŒ์ดํŠธ๊ฐ€ ํ˜ธ์ถœํ•˜๋Š” ์„ ํƒ์ž์— ์‘๋‹ตํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ๋‚ด์„ฑ์„ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.!!! ๊ตฌํ˜„ํ•˜์ง€ ์•Š์€ ๋ฉ”์†Œ๋“œ ํ˜ธ์ถœ ์‹œ null๊ฐ’์„ ๋ณด๋‚ด Crash๊ฐ€ ๋‚˜๊ธฐ ๋•Œ๋ฌธ!!! ๐Ÿ˜ญ ๋”ฐ๋ผ์„œ, ๋ฐ˜๋“œ์‹œ ํ”„๋กœํ† ์ฝœ์˜ ์˜ต์…”๋„ ๋ฉ”์†Œ๋“œ ์‚ฌ์šฉ ์ „ ๊ตฌํ˜„ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•˜๋Š” ์ ˆ์ฐจ๋ฅผ ์ˆ˜ํ–‰ํ•ด์•ผํ•œ๋‹ค. ๐Ÿ‘๐Ÿป โ–ถ Objective-C ํ”„๋กœํ† ์ฝœ ๋ฉ”์†Œ๋“œ ๊ตฌํ˜„ ์—ฌ๋ถ€ ํ™•์ธํ•˜๊ธฐ ์ผ๋‹จ ObjC ์—์„œ ํ”„๋กœํ† ์ฝœ์€ ์•„๋ž˜ ์ฝ”๋“œ์™€ ๊ฐ™์ด ํ‚ค์›Œ๋“œ๊ฐ€ ์—†๋Š” ๋ฉ”์†Œ๋“œ๋Š” ๋ชจ๋‘ ํ•„์ˆ˜์ ์œผ๋กœ ๊ตฌํ˜„ํ•ด์•ผ ํ•˜๋Š” ๋ฉ”์†Œ๋“œ, @optional ํ‚ค์›Œ๋“œ ๋‹ค์Œ์— ๋‚˜์˜ค๋Š” ๋ฉ”์†Œ๋“œ๋“ค..
[MacOS] ๋งฅ๋ถTip - ๋งฅ๋ถ ์ด๋ฏธ์ง€ ์šฉ๋Ÿ‰ ์ค„์ด๊ธฐ ๋งฅ๋ถ์—์„œ ์ด๋ฏธ์ง€ ์šฉ๋Ÿ‰ ์ค„์ด๋Š” ๋ฒ•์„ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค! ๋ธ”๋กœ๊ทธ ๊ฐ™์€ ์›น์‚ฌ์ดํŠธ์— ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œ ์‹œ, ์šฉ๋Ÿ‰์œผ๋กœ ์ธํ•ด ์ œํ•œ์„ ๋ฐ›๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์ž–์•„์š”ใ… ใ…กใ…  ์ด๋Ÿฌํ•œ ๊ฒฝ์šฐ ์‚ฌ์šฉํ•˜๋ฉด ์ข‹์€ ์‚ฌ์ง„ ์šฉ๋Ÿ‰ ์ค„์ด๋Š” Tip์ž…๋‹ˆ๋‹ค. ๋”ฐ๋กœ ํ”„๋กœ๊ทธ๋žจ ์„ค์น˜๊ฐ€ ํ•„์š” ์—†์–ด ๋งค์šฐ ๊ฐ„๋‹จํ•ฉ๋‹ˆ๋‹ค:) 1. ์ด๋ฏธ์ง€ ์—ด๊ธฐ Finder์—์„œ ์ด๋ฏธ์ง€๋ฅผ ์—ด์–ด์ฃผ์„ธ์š”. 2. ๋งˆํฌ์—… ํด๋ฆญ! ์ด๋ฏธ์ง€๋ฅผ ์—ด๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ๋ณด์ด๋Š” ๋งˆํฌ์—… ๋ฒ„ํŠผ์„ ํด๋ฆญ! 3. ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์กฐ์ ˆ ๋ฒ„ํŠผ ํด๋ฆญ! ๋งˆํฌ์—… ํด๋ฆญ ์‹œ ๋ณด์ด๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์กฐ์ ˆ ๋ฒ„ํŠผ์„ ํด๋ฆญ! 4. ํฌ๊ธฐ ์กฐ์ ˆ ์•„๋ž˜์™€ ๊ฐ™์ด ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์กฐ์ ˆ ํ™”๋ฉด์ด ๋‚˜์˜ต๋‹ˆ๋‹ค. ์ด๋•Œ, ์ƒ๋‹จ์— ์‚ฌ์šฉ์žํ™”๋กœ ๋˜์–ด์žˆ๋Š” ํฌ๊ธฐ ์กฐ์ ˆ์„ ํด๋ฆญํ•ด์„œ ๋ณ€๊ฒฝํ•  ๋•Œ๋งˆ๋‹ค ํ•˜๋‹จ์— ๊ฒฐ๊ณผ ํฌ๊ธฐ๊ฐ€ ๋ณ€๊ฒฝ๋ฉ๋‹ˆ๋‹ค. ์›ํ•˜๋Š” ๊ฒฐ๊ณผ ํฌ๊ธฐ์— ๋งž๊ฒŒ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๋กœ ๋งž์ถฐ์„œ ํ™•์ธ ๋ฒ„ํŠผ์„..
[Swift] 1. ๋ช…๋ช…๋ฒ•, ์ฝ˜์†” ๋กœ๊ทธ, ๋ฌธ์ž์—ด ๋ณด๊ฐ„๋ฒ• 1. ๋ช…๋ช…๋ฒ• Swift์—์„œ๋Š” ์ด๋ฆ„์„ ์ง€์„ ๋•Œ ์นด๋ฉœ์ผ€์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , ๋ชจ๋“  ๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•œ๋‹ค. Lower Camel Case(์†Œ๋ฌธ์ž๋กœ ์‹œ์ž‘) : fuction, method, variable, constant ex) viewDidLoad, userTable ๋“ฑ Upper Camel Case(๋Œ€๋ฌธ์ž๋กœ ์‹œ์ž‘) : type(class, struct, enum, extension…) ex) Person, Point, Week ๋“ฑ 2. ์ฝ˜์†”๋กœ๊ทธ print ํ•จ์ˆ˜ : ๋‹จ์ˆœ ๋ฌธ์ž์—ด ์ถœ๋ ฅ dump ํ•จ์ˆ˜ : ์ธ์Šคํ„ด์Šค์˜ ์ž์„ธํ•œ ์„ค๋ช…(description ํ”„๋กœํผํ‹ฐ)๊นŒ์ง€ ์ถœ๋ ฅ class Person { var name: String = "TechYeon" var age: Int = 10 } let techYeon: Person..

๋ฐ˜์‘ํ˜•