์ ‘๊ทผ์ œ์–ด์ž
ยท
๐ŸŽ iOS/Swift
open๋ชจ๋“ˆ ์™ธ๋ถ€์—์„œ ์ ‘๊ทผ ๊ฐ€๋Šฅ, ์ƒ์† ๋ฐ ์˜ค๋ฒ„๋ผ์ด๋”ฉ ํ—ˆ์šฉํ”„๋ ˆ์ž„์›Œํฌ ์ผ๋ถ€๋ฅผ ์‚ฌ์šฉ์ž์—๊ฒŒ ๊ณต๊ฐœํ• ๋•Œ ์‚ฌ์šฉ public๋ชจ๋“ˆ ์™ธ๋ถ€์—์„œ ์ ‘๊ทผ ๊ฐ€๋Šฅ, ์ƒ์†๊ณผ ์˜ค๋ฒ„๋ผ์ด๋”ฉ ์ œํ•œ์ฃผ๋กœ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋‚˜ ํ”„๋ ˆ์ž„์›Œํฌ์˜ ์ผ๋ถ€ ๊ธฐ๋Šฅ์„ ๊ณต๊ฐœํ•  ๋•Œ ์‚ฌ์šฉ internal๋ชจ๋“ˆ ๋‚ด์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ, ์•ฑ์˜ ๋Œ€๋ถ€๋ถ„์˜ ์ฝ”๋“œ์—์„œ ๊ธฐ๋ณธ์ ์œผ๋กœ ์‚ฌ์šฉ fileprivate๊ฐ™์€ ํŒŒ์ผ ๋‚ด์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ, ํŒŒ์ผ ๋‹จ์œ„๋กœ ์บก์Šํ™”๋ฅผ ์ ์šฉํ•˜๊ณ ์ž ํ•  ๋•Œ ์œ ์šฉ privateํ•ด๋‹น ์„ ์–ธ์ด ํฌํ•จ๋œ ์Šค์ฝ”ํ”„(ํด๋ž˜์Šค, ๊ตฌ์กฐ์ฒด ๋“ฑ) ๋‚ด์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ๊ฐ€์žฅ ๊ฐ•๋ ฅํ•œ ์ œํ•œ์œผ๋กœ ๋ฏผ๊ฐํ•œ ๋ฐ์ดํ„ฐ๋‚˜ ๋‚ด๋ถ€ ๊ตฌํ˜„์‚ฌํ•ญ์„ ๋ณดํ˜ธํ•  ๋•Œ ์‚ฌ์šฉ
Lazy์™€ weak์„ ํ•จ๊ป˜ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ์ด์œ 
ยท
๐ŸŽ iOS/Swift
Lazy ์†์„ฑ์˜ ํŠน์ง• lazy ์†์„ฑ์€ ์ฒ˜์Œ์œผ๋กœ ์ ‘๊ทผํ•  ๋•Œ ์ดˆ๊ธฐํ™”๋œ๋‹ค.๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ๋œ ์ดํ›„์— ๊ฐ’์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์–ด, ์ดˆ๊ธฐํ™” ์‹œ์ ์—์„œ ํŠน์ • ๊ฐ’์ด ์ค€๋น„๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ์— ์œ ์šฉํ•˜๋‹ค.lazy ์†์„ฑ์€ ์ธ์Šคํ„ด์Šค๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ์— ํ™•์‹คํžˆ ์กด์žฌํ•˜๋Š” ๋™์•ˆ ์œ ์ง€๋˜๋ฉฐ, ๊ทธ ์ธ์Šคํ„ด์Šค๊ฐ€ ํ•„์š”ํ•  ๋•Œ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ์ดˆ๊ธฐํ™”๋œ๋‹ค. Weak ์†์„ฑ์˜ ํŠน์ง•weak ์†์„ฑ์€ ์•ฝํ•œ ์ฐธ์กฐ๋ฅผ ๊ฐ€๋ฆฌํ‚จ๋‹ค.์•ฝํ•œ ์ฐธ์กฐ๋Š” ๋ฉ”๋ชจ๋ฆฌ ์ˆœํ™˜ ์ฐธ์กฐ๋ฅผ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋ฉฐ, ์ฐธ์กฐํ•˜๋Š” ๊ฐ์ฒด๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ํ•ด์ œ๋˜๋ฉด nil๋กœ ์„ค์ •๋œ๋‹ค.์•ฝํ•œ ์ฐธ์กฐ๋Š” ํ•ญ์ƒ Optional ํƒ€์ž…์ด์–ด์•ผ ํ•˜๋ฉฐ, ๊ฐ€๋ฆฌํ‚ค๋Š” ๊ฐ์ฒด์˜ ์ˆ˜๋ช…์ด ๋‹คํ•˜๋ฉด ์ž๋™์œผ๋กœ ํ•ด์ œ๋œ๋‹ค. ํ˜ธํ™˜๋˜์ง€ ์•Š๋Š” ์ด์œ lazy ์†์„ฑ์€ ์ดˆ๊ธฐํ™” ์‹œ์ ์„ ๋ณด์žฅํ•ด์•ผ ํ•˜๋Š”๋ฐ, weak ์†์„ฑ์€ ์–ธ์ œ๋“ ์ง€ nil์ด ๋  ์ˆ˜ ์žˆ๋Š” ํŠน์„ฑ์„ ๊ฐ–๊ณ  ์žˆ๋‹ค.๋”ฐ๋ผ์„œ ์ฐธ์กฐ๋ฅผ ์ง€์†ํ•  ์ˆ˜ ์—†..
UI๋ฅผ ๋ฉ”์ธ์Šค๋ ˆ๋“œ์—์„œ ๊ตฌํ˜„ํ•ด์•ผํ•˜๋Š” ์ด์œ 
ยท
๐ŸŽ iOS/Swift
UI๋Š” ์™œ ๋ฉ”์ธ์Šค๋ ˆ๋“œ์—์„œ ๊ตฌํ˜„ํ•ด์•ผํ• ๊นŒ? UIKit์˜ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ ์„ค๊ณ„ ์›์น™UIKit์€ UI์ž‘์—…์„ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ์—์„œ ์ˆ˜ํ–‰ํ•˜๋„๋ก ์„ค๊ณ„๋˜์–ด์žˆ๋‹ค.์ด๊ฒƒ์„ ๋”ฐ๋ฅด์ง€ ์•Š์œผ๋ฉด UI๊ฐ€ ๋น„๋™๊ธฐ์ ์œผ๋กœ ๋ฐฑ๊ทธ๋ผ์šด๋“œ ์Šค๋ ˆ๋“œ์—์„œ ์—…๋ฐ์ดํŠธ ๋˜๋ฉฐ, ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ์ถฉ๋Œ์ด๋‚˜ ๋ Œ๋”๋ง์— ์‹คํŒจํ•  ์ˆ˜ ์žˆ๋‹ค. ์Šค๋ ˆ๋“œ ์•ˆ์ •์„ฑUIKit์˜ ๊ตฌ์„ฑ ์š”์†Œ๋Š” ๋Œ€๋ถ€๋ถ„ Thread-safeํ•˜๊ฒŒ ์„ค๊ณ„๋˜์ง€ ์•Š์•˜๋‹ค.์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ์—์„œ UI๋ฅผ ๋™์‹œ์— ์ˆ˜์ •ํ•˜๋ ค๊ณ ํ•˜๋ฉด Race condition์ด๋‚˜ ๋ถˆ์•ˆ์ •์„ฑ์ด ๋ฐœ์ƒํ•˜์—ฌ ์•ฑ์ด ๋ถˆ๊ทœ์น™ํ•˜๊ฒŒ ์ž‘๋™ํ•  ์ˆ˜ ์žˆ๋‹ค.๋ฉ”์ธ ์Šค๋ ˆ๋“œ๋ฅผ ์‚ฌ์šฉํ•จ์œผ๋กœ์จ ์ด๋Ÿฐ ์ถฉ๋Œ์„ ์˜ˆ๋ฐฉํ•  ์ˆ˜์žˆ๋‹ค. Race Condition?2๊ฐœ ์ด์ƒ์˜ ์Šค๋ ˆ๋“œ๋‚˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๊ณต์œ ์ž์›์— ๋™์‹œ์— ์ ‘๊ทผํ•˜๊ณ  ์ˆ˜์ •ํ•  ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ์˜ˆ) ์€ํ–‰ ๊ฑฐ๋ž˜ ์‹œ์Šคํ…œ์—์„œ ์—ฌ๋Ÿฌ ์‚ฌ์šฉ์ž๊ฐ€ ๋™์‹œ์— ๊ฐ™์€ ๊ณ„์ขŒ์—์„œ ๋ˆ์„ ์ธ์ถœ..
matchedGeometryEffect(Hero animation)
ยท
๐ŸŽ iOS/SwiftUI
matchedGeometryEffect์‹๋ณ„์ž์™€ ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๊ธฐํ•˜ํ•™์ด ๋™๊ธฐํ™”๋œ ๋ทฐ ๊ทธ๋ฃน์„ ์ •์˜. ์ด modifier๋ฅผ ์—ฌ๋Ÿฌ ๋ทฐ์— ๋ถ€์ฐฉํ•˜๋ฉด SwiftUI๊ฐ€ ๋ทฐ ๊ฐ„์˜ ์—ฐ๊ฒฐ์„ ์ดํ•ดํ•˜๊ณ , ์ž๋™์œผ๋กœ Transition์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค. 1. ๊ธฐ๋ณธ ๊ตฌ์กฐ์„ค์ •@Namespace var animation SwiftUI์—์„œ Hero ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ๋จผ์ € ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ •์˜ํ•œ๋‹ค.2. ๋ทฐ์— modifier ๋ถ™์ด๊ธฐVStack { if shouldAnimate { Rectangle () .matchedGeometryEffect(id: "shape" , in: animation) } else { Rectangle () .matc..
matchedGeometryEffect
ยท
๐ŸŽ iOS/SwiftUI
matchedGeometryEffect์‹๋ณ„์ž์™€ ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๊ธฐํ•˜ํ•™์ด ๋™๊ธฐํ™”๋œ ๋ทฐ ๊ทธ๋ฃน์„ ์ •์˜. ์ด modifier๋ฅผ ์—ฌ๋Ÿฌ ๋ทฐ์— ๋ถ€์ฐฉํ•˜๋ฉด SwiftUI๊ฐ€ ๋ทฐ ๊ฐ„์˜ ์—ฐ๊ฒฐ์„ ์ดํ•ดํ•˜๊ณ , ์ž๋™์œผ๋กœ Transition์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค. 1. ๊ธฐ๋ณธ ๊ตฌ์กฐ์„ค์ •@Namespace var namespace SwiftUI์—์„œ Hero ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ๋จผ์ € ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ •์˜ํ•œ๋‹ค.
Photos ํ”„๋ ˆ์ž„์›Œํฌ
ยท
๐ŸŽ iOS/Swift
PHAsset์‚ฌ์ง„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ์žˆ๋Š” ์ด๋ฏธ์ง€, ๋น„๋””์˜ค์™€ ๊ฐ™์€ ํ•˜๋‚˜์˜ Asset์„ ์˜๋ฏธ PHAssetCollectionPHAsset์˜ ์ปฌ๋ ‰์…˜ PHCachingImageManager์š”์ฒญํ•œ ํฌ๊ธฐ์— ๋งž๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ๋กœ๋“œํ•˜์—ฌ ์บ์‹ฑ๊นŒ์ง€ ์ˆ˜ํ–‰ PHFetchResult์•จ๋ฒ” ํ•˜๋‚˜ PHPhotoLibraryChangeObserver์‚ฌ์ง„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋Œ€ํ•œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๊ฐ์ง€ํ•˜๊ณ  ์‘๋‹ตํ•˜๊ธฐ ์œ„ํ•œ ํ”„๋กœํ† ์ฝœ ์‚ฌ์šฉ์ž๊ฐ€ ์‚ฌ์ง„์„ ์ถ”๊ฐ€, ์‚ญ์ œ, ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜ ์•จ๋ฒ”์— ๋ณ€ํ™”๋ฅผ ์ฃผ๋Š” ๊ฒฝ์šฐ ๋ฉ”์„œ๋“œ๊ฐ€ ํ˜ธ์ถœ๋œ๋‹ค. photoLibraryDidChange(_:): ๋ณ€๊ฒฝ ๊ฐ์ง€ ๋ฉ”์„œ๋“œ (๊ผญ ๊ตฌํ˜„ํ•ด์•ผํ•จ)PHPhotoLibrary.shared().register(_:): ์˜ต์ €๋ฒ„ ๋“ฑ๋กPHPhotoLibrary.shared().unregisterChangeObserver..
Photos ํ”„๋ ˆ์ž„์›Œํฌ ๊ณต์‹๋ฌธ์„œ ๋ฒˆ์—ญ
ยท
๐ŸŽ iOS/Swift
Photos ํ”„๋ ˆ์ž„์›Œํฌ์‚ฌ์ง„ ์•ฑ์—์„œ ๊ด€๋ฆฌํ•˜๋Š” ์ด๋ฏธ์ง€ ๋ฐ ๋น„๋””์˜ค Asset์„ ๋‹ค๋ฃจ๋Š” ํ”„๋ ˆ์ž„์›Œํฌ. ์—ฌ๊ธฐ์—๋Š” iCloud ์‚ฌ์ง„๊ณผ ๋ผ์ด๋ธŒ ์‚ฌ์ง„์ด ํฌํ•จ๋œ๋‹ค.PhotoKit์„ ์‚ฌ์šฉํ•˜์—ฌ iOS, macOS, tvOS ๋ฐ visionOS์—์„œ ์‚ฌ์ง„ ์•ฑ์ด ๊ด€๋ฆฌํ•˜๋Š” ์ด๋ฏธ์ง€ ๋ฐ ๋น„๋””์˜ค Asset์— ์ ‘๊ทผํ•ฉ๋‹ˆ๋‹ค. ์ด ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์˜ ์‚ฌ์ง„์„ ํŽธ์ง‘ํ•˜๊ฑฐ๋‚˜ ํ‘œ์‹œํ•˜๊ฑฐ๋‚˜ ์•จ๋ฒ”, ์ˆœ๊ฐ„ ๋ฐ ๊ณต์œ  ์•จ๋ฒ”๊ณผ ๊ฐ™์€ Asset ์ปฌ๋ ‰์…˜์„ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํ”„๋ ˆ์ž„์›Œํฌ๋Š” ์‚ฌ์šฉ์ž์˜ ์žฅ์น˜์™€ iCloud์— ์žˆ๋Š” ์‚ฌ์ง„์— ๋Œ€ํ•œ ์ ‘๊ทผ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.์•ฑ์—์„œ ์‚ฌ์šฉ์ž์˜ ์‚ฌ์ง„์— ์ ‘๊ทผํ•˜๋Š” ๊ฒƒ ์™ธ์—๋„, ์•ฑ ํ™•์žฅ์„ ๊ตฌ์ถ•ํ•˜๊ณ  ์•ฑ์˜ ๊ธฐ๋Šฅ์„ iOS ๋˜๋Š” macOS์˜ ์‚ฌ์ง„ ์•ฑ์— ์ง์ ‘ ํ†ตํ•ฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๋“ค์ด ์‚ฌ์ง„๊ณผ ๋น„๋””์˜ค๋ฅผ ํŽธ์ง‘ํ•˜๊ฑฐ๋‚˜ ํ•„ํ„ฐ ๋ฐ ํšจ๊ณผ๋ฅผ ์ ์šฉํ•  ์ˆ˜ ..
Failed to load Info.plist from bundle
ยท
๐ŸŽ iOS/๋””๋ฒ„๊น…
๋ฌธ์ œ์›์ธ Xcode ์บ์‹œ๋ฅผ ์‚ญ์ œํ•ด์„œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ผ๋ถ€ ํŒŒ์ผ์ด ๋ˆ„๋ฝ๋จ ํ•ด๊ฒฐ๋ฐฉ๋ฒ• File-Packages-Reset Package Cashes
[SwiftUI] Custom Picker
ยท
๐ŸŽ iOS/SwiftUI
import SwiftUIimport SwiftUIIntrospectenum BirthPickerType { case year case month}struct BirthPickerView: View { let type: BirthPickerType @Binding var selectedNumber: Int let years = Array(1923...2022) let months = Array(1...12) @State private var originOffset: CGFloat = 0 @State private var lastOffset: CGFloat = 0 @State private var currentOffset: CGFloat..
Introspect
ยท
๐ŸŽ iOS/SwiftUI
Introspect SwiftUI์—์„œ UIKit ๋˜๋Š” AppKit ์š”์†Œ๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ. github https://github.com/siteline/SwiftUI-Introspect GitHub - siteline/swiftui-introspect: Introspect underlying UIKit/AppKit components from SwiftUI Introspect underlying UIKit/AppKit components from SwiftUI - GitHub - siteline/swiftui-introspect: Introspect underlying UIKit/AppKit components from SwiftUI github.com ์‚ฌ์šฉ ์˜ˆ์‹œ ๊ณต์‹ ๋ฌธ์„œ https..
JerryiOS
'๐ŸŽ iOS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก