Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Project B — Diffable Data Source

Project A-Z 의 B 단계.

단계마다 새로운 기술 스택을 하나씩 더해가며, 조금씩 다른 기능을 구현해 나갑니다. B 단계에서는 A 단계(UIKit + MVVM)의 컬렉션 뷰를 Diffable Data Source 기반으로 교체합니다.

다루는 기술

  • UIKit (Programmatic, Storyboard 없음)
  • MVVM (View ↔ ViewModel 클로저 바인딩)
  • Diffable Data Source (UICollectionViewDiffableDataSource + NSDiffableDataSourceSnapshot) ← 이번 단계 추가분

기능

월간 달력 + 날짜별 한 줄 메모. (A 단계와 동일한 기능을 Diffable 방식으로 다시 구성)

A 단계와 달라진 점

A (UIKit + MVVM) B (+ Diffable)
데이터 소스 UICollectionViewDataSource 직접 구현 UICollectionViewDiffableDataSource
셀 등록 register + dequeueReusableCell UICollectionView.CellRegistration
갱신 방식 collectionView.reloadData() (전체) snapshot.apply / reconfigureItems (변경분만)
ViewModel 신호 onUpdate: (() -> Void)? onUpdate: ((CalendarUpdate) -> Void)?
모델 요구사항 CalendarDay: Hashable (셀 식별자)

핵심 아이디어: ViewModel이 "무엇이 바뀌었는지"를 CalendarUpdate enum으로 알려주고 (.daysReplaced / .daysUpdated([CalendarDay])), View는 달 전체가 바뀌면 스냅샷을 새로 적용하고 선택·메모 같은 부분 변경은 해당 셀만 reconfigureItems로 다시 그립니다.

구조

ProjectB/
├── App/
│   ├── AppDelegate.swift
│   └── SceneDelegate.swift
└── Scenes/Calendar/
    ├── Model/CalendarDay.swift          # Hashable — diffable 식별자
    ├── ViewModel/CalendarViewModel.swift # CalendarUpdate 신호 방출
    └── View/
        ├── CalendarViewController.swift  # Diffable Data Source + Snapshot
        └── CalendarDayCell.swift

빌드

Xcode 16+ / iOS 16.0+ / Swift 5.0. 외부 의존성 없음.

open ProjectB.xcodeproj

Project A-Z

실무에서 다뤄온 기술을 단계별로 정리하는 프로젝트입니다.

추가 스택
A UIKit + MVVM
B Diffable Data Source
C Combine
D async/await
E Clean Architecture
F XCTest
G SwiftUI
H SPM 모듈화
I Micro Feature Architecture
J Tuist
K Core Data
L CloudKit
M APNs
N SwiftData
O Objective-C + libexif
P Swift Testing
Q UI Test
R CI/CD (GitHub Actions)

각 단계는 별도 레포로 관리합니다.

About

Project A-Z · B단계 — 컬렉션 뷰를 Diffable Data Source 로 교체

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages