๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ป iOSun
article thumbnail
[Swift Language Guide] ๊ธฐ๋ณธ (The Basics)
Swift Language Guide 2023. 5. 16. 22:09

์ดˆ๋ฐ˜์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์•„๋Š” ์ง€์‹์€ ๊ฐ„๋‹จํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๊ฑฐ๋‚˜ ํŒจ์Šคํ•˜๊ณ  ์ƒˆ๋กญ๊ฒŒ ์•Œ๊ฒŒ ๋œ ์ง€์‹ ์œ„์ฃผ๋กœ ์ •๋ฆฌํ•ด ๋ณด๋ ค ํ•ฉ๋‹ˆ๋‹ค! ์ƒ์ˆ˜์™€ ๋ณ€์ˆ˜ (Constants and Variables) let maximumNumberOfLoginAttempts = 10 // ์ƒ์ˆ˜ -> ๊ฐ’ ๋ณ€๊ฒฝ ๋ถˆ๊ฐ€๋Šฅ var currentLoginAttempt = 0 // ๋ณ€์ˆ˜ -> ๊ฐ’ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅ var x = 0.0, y = 0.0, z = 0.0 ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์ƒ์ˆ˜ ๋˜๋Š” ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•  ๋•Œ, ํ•œ ์ค„๋กœ ์„ ์–ธ์ด ๊ฐ€๋Šฅํ•˜๋‹ค. let input = readLine()!.split(separator: " ").map { Int(String($0))! } let height = input[0], width = input[1], k = input[2] ๊ฐœ์ธ์ ์œผ๋กœ ์•Œ๊ณ ๋ฆฌ์ฆ˜..

article thumbnail
YAPP 21๊ธฐ ํ™œ๋™ ํ›„๊ธฐ & iOS ๋ฉด์ ‘ ์งˆ๋ฌธ ๋ฆฌ์ŠคํŠธ
ํ›„๊ธฐ 2023. 4. 14. 00:49

IT์—ฐํ•ฉ๋™์•„๋ฆฌ YAPP ๋งค์šฐ ๋Šฆ์€ ํ›„๊ธฐ...! 2022.10์›” ๋ง ~ 2023.02์›” ๋ง๊นŒ์ง€ yapp์— iOS ๊ฐœ๋ฐœ์ž๋กœ ํ™œ๋™ํ–ˆ๋‹ค. ์ง„์ž‘์— ํ›„๊ธฐ๋ฅผ ์“ฐ๋ คํ–ˆ๋Š”๋ฐ ๋ฏธ๋ฃจ๊ณ  ๋ฏธ๋ฃจ๋‹ค๊ฐ€ ๋งˆ์นจ ์ง€๊ธˆ 22๊ธฐ ๋ฆฌํฌ๋ฃจํŒ… ๊ธฐ๊ฐ„์ด๊ธฐ๋„ ํ•˜๊ณ .. ์ด์ œ์•ผ ์ ๋Š”์ค‘..!!๐Ÿ˜‚ ์–์—์„œ ์ •๋ง ๋งŽ์€ ๊ฑธ ๋ฐฐ์› ๊ณ  ๋„ˆ๋ฌด ๋œป๊นŠ์€ ์‹œ๊ฐ„์ด์—ˆ๊ธฐ์— ํ›„๊ธฐ๋ฅผ ์“ด๋‹ค ใ…Žใ…Ž ๋ฉด์ ‘ ์–์€ ์„œ๋ฅ˜ ๋ฐœํ‘œ ํ›„ ๋ฉด์ ‘์„ ์ง„ํ–‰ํ•œ๋‹ค. ์•ฑ ์ถœ์‹œ ๊ฒฝํ—˜์ด ์—†์–ด์„œ ๋ถ™์„๊นŒ ํ–ˆ๋Š”๋ฐ ๋‹คํ–‰ํžˆ ์„œ๋ฅ˜ ํ•ฉ๊ฒฉํ•˜๊ณ  ๋ฉด์ ‘์„ ๋ดค๋‹ค! iOSํŒŒํŠธ ๋ฉด์ ‘ ์งˆ๋ฌธ ์ž๊ธฐ์†Œ๊ฐœ yapp์—์„œ ๋ญ˜ ํ•˜๊ณ  ์‹ถ์€์ง€ ๊ฐœ๋ฐœ์ž๋กœ์„œ ์žฅ๋‹จ์  PR์—์„œ ๋ฆฌ๋ทฐ ํ•˜๋Š”๋ฐ์— ์ค‘์ ์„ ๋‘๋Š” ๊ฒƒ ํ˜‘์—…ํ•˜๋ฉด์„œ ํž˜๋“  ์‚ฌ๋žŒ ๊ฐˆ๋“ฑ์ด ์žˆ๋‹ค๋ฉด? ์Šคํ† ๋ฆฌ๋ณด๋“œ์™€ ์ฝ”๋“œ ๊ตฌํ˜„์„ ๋‘˜ ๋‹ค ์‚ฌ์šฉํ•œ ์ด์œ  (๊ฐœ์ธ) DiffableDatasource์˜ ์žฅ๋‹จ์ ? (์„œ๋ฅ˜ ๊ธฐ๋ฐ˜ ๊ฐœ์ธ) ๋งŒ์•ฝ์— ๋‚ด๊ฐ€..

article thumbnail
[๋ฐฑ์ค€ 1743] swift ์Œ์‹๋ฌผ ํ”ผํ•˜๊ธฐ: DFS

๋ฌธ์ œ ์„ค๋ช… https://www.acmicpc.net/problem/1743 1743๋ฒˆ: ์Œ์‹๋ฌผ ํ”ผํ•˜๊ธฐ ์ฒซ์งธ ์ค„์— ํ†ต๋กœ์˜ ์„ธ๋กœ ๊ธธ์ด N(1 ≤ N ≤ 100)๊ณผ ๊ฐ€๋กœ ๊ธธ์ด M(1 ≤ M ≤ 100) ๊ทธ๋ฆฌ๊ณ  ์Œ์‹๋ฌผ ์“ฐ๋ ˆ๊ธฐ์˜ ๊ฐœ์ˆ˜ K(1 ≤ K ≤ N×M)์ด ์ฃผ์–ด์ง„๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๋‹ค์Œ K๊ฐœ์˜ ์ค„์— ์Œ์‹๋ฌผ์ด ๋–จ์–ด์ง„ ์ขŒํ‘œ (r, c)๊ฐ€ ์ฃผ์–ด์ง„๋‹ค www.acmicpc.net ๊ฐ„๋‹จํ•˜๊ฒŒ ์ƒํ•˜์ขŒ์šฐ๋กœ ์›€์ง์ผ ์ˆ˜ ์žˆ๊ณ  ๊ทธ ์“ฐ๋ ˆ๊ธฐ์˜ ํฌ๊ธฐ๋ฅผ ๊ตฌํ•˜๋Š” ๋ฌธ์ œ์ด๋‹ค. ๋ฌธ์ œ ํ’€์ด DFS๋กœ ํ’€์–ด๋ดค๋‹ค. 2์ฐจ์›๋ฐฐ์—ด๋กœ map๊ณผ visited ๋ฐฐ์—ด์„ ๋งŒ๋“ค๊ณ  ์“ฐ๋ ˆ๊ธฐ๋ฉด 1, ์•„๋‹ˆ๋ฉด 0์œผ๋กœ ํ‘œ์‹œํ–ˆ๋‹ค. 1000 0110 1100 ์œ„์˜ ์˜ˆ์ œ์—์„œ ์ด๋ ‡๊ฒŒ.. ๊ทธ๋ฆฌ๊ณ  for๋ฌธ์„ ๋Œ๋ฉด์„œ ์“ฐ๋ ˆ๊ธฐ์ด๊ณ  ๋ฐฉ๋ฌธํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ์— DFS๋ฅผ ๋Œ๋ ค์ฃผ๋ฉฐ count๋ฅผ +1 ํ•ด์ฃผ์—ˆ๋‹ค...

article thumbnail
[iOS] NotificationCenter ๋™์ž‘ ๋ฐฉ์‹๊ณผ ํ™œ์šฉ ๋ฐฉ์•ˆ์— ๋Œ€ํ•ด ์„ค๋ช…ํ•˜์‹œ์˜ค.
iOS 2023. 3. 31. 20:32

NotificationCenter๋ž€? observer(๊ด€์ฐฐ์ž)์—๊ฒŒ ์ •๋ณด๋ฅผ ์ „๋‹ฌํ•ด์ฃผ๋Š” ์•Œ๋ฆผ ๋ฐœ์†ก ๋ฉ”์ปค๋‹ˆ์ฆ˜ ์–ธ์ œ Notification ์„ผํ„ฐ๋ฅผ ์‚ฌ์šฉ? ์•ฑ ๋‚ด์—์„œ ๊ณต์‹์ ์ธ ์—ฐ๊ฒฐ์ด ์—†๋Š” ๋‘ ๊ฐœ ์ด์ƒ์˜ ์ปดํฌ๋„ŒํŠธ๋“ค์ด ์ƒํ˜ธ์ž‘์šฉ์ด ํ•„์š”ํ•  ๋•Œ ์ƒํ˜ธ์ž‘์šฉ์ด ๋ฐ˜๋ณต์ ์œผ๋กœ ๊ทธ๋ฆฌ๊ณ  ์ง€์†์ ์œผ๋กœ ์ด๋ฃจ์–ด์ ธ์•ผ ํ•  ๋•Œ ์ผ๋Œ€๋‹ค ๋˜๋Š” ๋‹ค๋Œ€๋‹ค ํ†ต์‹ ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ 1. Observer(๊ด€์ฐฐ์ž) ๋“ฑ๋ก NotificationCenter.default.addObserver( self, selector: #selector(scrollToBottom), // ์•Œ๋ฆผ์„ ๋ฐ›์„ ๋•Œ ์ˆ˜ํ–‰ํ•  action name: NSNotification.Name("TestNotification"), object: nil ) ์•Œ๋ฆผ์„ ๋ฐ›๊ณ  ์‹ถ์€ ๋ถ€๋ถ„์— observer๋ฅผ ๋“ฑ๋กํ•œ๋‹ค...

profile on loading

Loading...