header-img
Info :
CS/iOS, Swift 18
[iOS] xcode์—์„œ ํ•˜์œ„ ํด๋” ๋ณด์ด์ง€ ์•Š๋Š” ๋ฌธ์ œ
2023.04.07
A. ๋ฌธ์ œ ์ƒํ™ฉ xcode์—์„œ git์œผ๋กœ ๋‹ค๋ฅธ branch์˜ ์ž‘์—…์‚ฌํ•ญ pullํ•œ ํ›„ workspace๋ฅผ ์—ฌ๋‹ˆ project navigator์— ํด๋” ๋‚ด ๋‹ค๋ฅธ ์‚ฌ๋žŒ์ด ์ž‘์—…ํ•œ ํŒŒ์ผ์ด ๋ณด์ด์ง€ ์•Š์•˜์Œ. ํŒŒ์ธ๋”์—์„œ ํด๋” ํ™•์ธํ•œ ๊ฒฐ๊ณผ ์ œ๋Œ€๋กœ pull๋„ ๋๊ณ  ํŒŒ์ผ๋„ ์กด์žฌํ–ˆ์Œ. B. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• project navigator์— ๋ˆ„๋ฝ๋œ ํ•˜์œ„ ํด๋”๋“ค์„ ๋“œ๋ž˜๊ทธํ•ด์„œ ๋„ฃ๊ณ  added folders๋ฅผ create groups๋กœ ์„ค์ •ํ•ด์„œ ๋„ฃ์–ด์ฃผ๋ฉด ๋จ. ์•„๋‹ˆ๋ฉด project navigator ์šฐํด๋ฆญ → add files to “…” ์„ ํƒ → ์ถ”๊ฐ€ํ•˜๋ ค๋Š” ํด๋” ๋„ฃ๊ณ  ์˜ต์…˜์„ ๋˜‘๊ฐ™์ด create groups๋กœ ์„ค์ •. ๊ทธ๋ฆฌ๊ณ  add ํ•ด์ฃผ๋ฉด ์ž˜ ๋“ค์–ด๊ฐ€ ์žˆ์Œ.
[iOS] unix timestamp swift
2023.04.07
A. ์„ค๋ช… iOS์˜ unixTimeStamp๋ฅผ ์‚ฌ์šฉํ•  ์ผ์ด ์žˆ์–ด์„œ ์ฐพ์•„๋ณด๋‹ˆ ๊ธฐ๋ณธ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์ด ์žˆ์Œ. Date().timeIntervalSince1970๋กœ ์‚ฌ์šฉํ•˜๋ฉด ๋˜๊ณ  1970๋…„ 1์›” 1์ผ 00์‹œ 00๋ถ„ 00์ดˆ ๊ธฐ์ค€์œผ๋กœ ๋ช‡ ์ดˆ๊ฐ€ ์ง€๋‚ฌ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ํ”„๋กœํผํ‹ฐ์ž„. ๋‚ด๊ฐ€ ํ•„์š”ํ–ˆ๋˜ ๊ฒƒ์€ ํ˜„์žฌ๊นŒ์ง€ 1357์ดˆ๊ฐ€ ์ง€๋‚ฌ๋‹ค๊ณ  ํ–ˆ์„ ๋•Œ 135๊นŒ์ง€ ํ•„์š”ํ–ˆ์œผ๋ฏ€๋กœ ์•„๋ž˜์™€ ๊ฐ™์€ ์ฒ˜๋ฆฌ๋ฅผ ์ถ”๊ฐ€์ ์œผ๋กœ ํ•ด์คฌ์Œ. (10์œผ๋กœ ๋‚˜๋ˆˆ ํ›„ Int๋กœ ํ˜•๋ณ€ํ™˜ํ•˜์—ฌ ๋‚˜๋จธ์ง€ ์ž˜๋ผ๋‚ด๊ธฐ) import UIKit class TimeSynchronizer { init() { } func getTimeInfo() -> String { var unixTS = Date().timeIntervalSince1970 unixTS = trunc(unixTS / 10..
[iOS] ์„œ๋ฒ„ ํ†ต์‹  Base Service
2023.04.07
A. ์„ค๋ช… api ํ†ต์‹  ํ•„์š”ํ•  ๋•Œ๋งˆ๋‹ค ๋ณด์ผ๋Ÿฌ ํ”Œ๋ ˆ์ดํŠธ ์ฝ”๋“œ๊ฐ€ ๋„ˆ๋ฌด ๋งŽ์ด ์ƒ๊ธฐ๋Š” ๊ฒƒ ๊ฐ™์•„ base๋กœ ์‚ฌ์šฉํ•  ์ฝ”๋“œ ๋งŒ๋“ฆ. ํ”„๋กœํ† ์ฝœ๋กœ ์ •์˜ํ•ด์„œ ์žฌ์‚ฌ์šฉ์„ฑ ์šฉ์ดํ•˜๋„๋ก ๊ตฌํ˜„ํ•จ. ์›น ์—ฐ๊ฒฐ์—๋Š” Alamofire ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์‚ฌ์šฉํ•จ. B. ์ฝ”๋“œ import Foundation import Alamofire protocol BaseService { /// api request url var url: String { get set } var header: HTTPHeaders { get set } var param: Encodable? { get set } /// Request์— ๋“ค์–ด๊ฐ€๋Š” .put, .get ๋“ฑ method var method: HTTPMethod { get set } /// Request์— ๋“ค์–ด๊ฐ€๋Š” P..
[iOS] ์›น๋ทฐ ์ฟ ํ‚ค ๊ด€๋ จ ์œ ํ‹ธ
2023.04.07
๊ธฐ๋ก์šฉ์œผ๋กœ ๋‚จ๊ฒจ๋†“๋Š” ๊ฒƒ์œผ๋กœ, ๋” ๊น”๋”ํ•˜๊ฒŒ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์กด์žฌํ•˜๊ฒ ์ง€๋งŒ.. ํ•˜๋‚˜ํ•˜๋‚˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋‹ค ๋„˜๊ธฐ๊ธฐ ์‹ซ๊ณ  ํ•จ์ˆ˜์˜ ๊ธธ์ด๋„ ๊ธธ์–ด์ง€๋Š”๊ฒŒ ์‹ซ์–ด์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ €๋Š” ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜ ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ๋งŒ๋“ค์–ด์ง„ ์ฟ ํ‚ค๋กœ ์›น๋ทฐ์— ๋„ฃ์—ˆ์„ ๋•Œ ์ •์ƒ ์ž‘๋™ํ–ˆ์Šต๋‹ˆ๋‹ค. import UIKit class CookieUtil { private let path: String = "/" let cookieDomain = "_" private enum cookieBaseName: String { case appId = "_" // ... } func getAppCookie() -> HTTPCookie? { guard let cookie = HTTPCookie(properties: [ .domain: cookieDomain, .pa..
[iOS] ํ‚ค์ฒด์ธ ์œ ํ‹ธ
2023.04.07
String ํƒ€์ž…์˜ ๊ฐ’ ํ‚ค์ฒด์ธ์— ์ €์žฅํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ๊ตฌํ˜„ํ•ด๋†“์€ ํ‚ค์ฒด์ธ ์œ ํ‹ธ ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค. ์‹ฑ๊ธ€ํ†ค์œผ๋กœ ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. store ์‹œ ์ด๋ฏธ ์กด์žฌํ•˜๋˜ ๊ฐ’์ด๋ฉด ์ž๋™์œผ๋กœ ์—…๋ฐ์ดํŠธ๊ฐ€ ๋˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ฐœ์ƒํ•˜๋Š” ๊ฐ์ข… ์˜ค๋ฅ˜์— ๋Œ€ํ•œ ์„ค๋ช…์€ ์ฃผ์„์œผ๋กœ ๋‹ฌ์•˜์Šต๋‹ˆ๋‹ค. import Foundation import Security enum KeyChainType: String { case tokenKey = "Token_Key" // ... } enum KeyChainError: Error { case invalidBundleID case invalidData case recognizedKeyChainError(OSStatus, CFString?) case unrecognizedKeyChainError case dataC..
list_img
[iOS] ํ•ด์‹ฑ
2023.04.07
์šฉ์–ด ์ •๋ฆฌ key : ํ•ด์‹ฑ๋˜๊ธฐ ์ „์˜ ๊ฐ’ digest : ํ•ด์‹ฑ๋œ ํ›„์˜ ๊ฐ’ rainbow table : ์—ฌ๋Ÿฌ ๊ฐ’๋“ค์„ ๋Œ€์ž…ํ•ด๋ณด๋ฉด์„œ ์–ป์€ ๋‹ค์ด์ œ์ŠคํŠธ๋“ค์„ ๋ชจ์•„๋†“์€ ํ…Œ์ด๋ธ” ํ•ด์‹œ ํ•จ์ˆ˜ ๋‹จ๋ฐฉํ–ฅ ํ•จ์ˆ˜๋กœ๋งŒ ์ž‘๋™ํ•จ input ๊ฐ’์ด ์•„์ฃผ ๋ฏธ์„ธํ•˜๊ฒŒ ๋‹ฌ๋ผ์ ธ๋„ output ๊ฐ’์€ ์ „ํ˜€ ๋‹ฌ๋ผ์ง → Avalanche Effect ํ•ด์‹œ ํ•จ์ˆ˜์˜ ์›๋ž˜ ์„ค๊ณ„ ๋ชฉ์ ์€ ๋น ๋ฅธ ๊ฒ€์ƒ‰์„ ์œ„ํ•จ์ž„ (OS ๋ถ€๋ถ„ ํ•ด์‹œํ…Œ์ด๋ธ” ์ฐธ๊ณ ) input ๊ฐ’์ด ๊ฐ™์œผ๋ฉด output ๊ฐ’์€ ํ•ญ์ƒ ๊ฐ™์Œ (์ฆ‰ ํ•จ์ˆ˜๋กœ์„œ ๊ธฐ๋Šฅํ•จ) ํ•ด์‹œ ํ•จ์ˆ˜์˜ ์œ„ํ—˜์„ฑ input์ด ๊ฐ™์œผ๋ฉด output์€ ํ•ญ์ƒ ๊ฐ™์œผ๋ฏ€๋กœ ํ•ด์‹ฑ๋œ ๋ฌธ์ž์—ด์˜ ์›๋ฌธ์„ ๋ ˆ์ธ๋ณด์šฐ ํ…Œ์ด๋ธ”์—์„œ ์ฐพ์„ ์œ„ํ—˜์„ฑ์ด ์กด์žฌํ•จ. brute-force ์›๋ž˜ ํ•ด์‹œ ํ•จ์ˆ˜๊ฐ€ ๋น ๋ฅธ ๊ฒ€์ƒ‰์„ ์œ„ํ•ด ์„ค๊ณ„๋˜์—ˆ๋‹ค ๋ณด๋‹ˆ ์‹ค์ œ ๋Ÿฐํƒ€์ž„์—์„œ์˜ ์†๋„๋„ ๋น ๋ฅธ ๊ฑด ๋งž์Œ. ํ•˜์ง€๋งŒ ๊ทธ..