일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- clean architecture
- collectionview
- 리펙토링
- map
- swiftUI
- RxCocoa
- uiscrollview
- combine
- ios
- swift documentation
- UICollectionView
- Protocol
- 클린 코드
- 스위프트
- 리펙터링
- SWIFT
- Refactoring
- Clean Code
- MVVM
- ribs
- uitableview
- 리팩토링
- Xcode
- tableView
- rxswift
- Observable
- Human interface guide
- 애니메이션
- UITextView
- HIG
- Today
- Total
목록NSCoding (2)
김종권의 iOS 앱 개발 알아가기
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bLXf8z/btq6A9cD6ii/AtZUbrmSnCFPfXxAtGOEaK/img.png)
아카이빙 iOS에서 모델 객체를 저장하는 방법 중 하나이며 가장 흔한 방법 객체 아카이브: 객체 그래프를 따라 객체의 데이터 내용을 저장하는 방식 객체 그래프: 객체들의 참조 관계를 나타낸 모습 NSCoding 프로토콜 사용: 가변객체나 다중참조 관계를 원래대로 복원해야하는 경우 NSCoding 프로토콜의 메서드: 객체 인스턴스를 encoding, edcoding 두 가지 기능 언아카이빙: 아카이브한 데이터로부터 객체를 생성 아카이빙 ex) UIView와 UIVeiwController들은 모두 NSCoding 프로토콜은 conform storyboard같은 interface 파일에 객체를 추가 -> 객체들이 아카이빙 -> 실행 중 객체들이 interface에서 언아카이빙되어 메모리에 로드 아카이빙 구현 ..
1. 저장될 클래스 타입 정의 class Meal { var name: String var photo: UIImage? var rating: Int init?(name: String, photo: UIImage?, rating: Int) { self.name = name self.photo = photo self.rating = rating } } 2. NSObject, NSCoding 상속 & 구현 func encode(with coder: NSCoder) { coder.encode(name, forKey: PropertyKeys.name) coder.encode(photo, forKey: PropertyKeys.photo) coder.encode(rating, forKey: PropertyKeys.r..