Truth
는 각각의 시스템이나 개체가 가지고 있는 자신만의 현재 상태나 데이터를 말함
중앙 집중화
navigationItem.rightBarButtonItem
let setupSearchDateButton = UIBarButtonItem(title: "날짜선택", style: .plain, target: self, action: #selector(didTapSetupSearchDateButton))
let childVC = ChildViewController()
// fullScreen is default value
childVC.modalPresentationStyle = .fullScreen
self.present(childVC, animated: true, completion: nil)
extension NSCache {
static let shared = NSCache<NSString, UIImage>()
}
단일 날짜
나 여러 날짜
를 선택할 수 있는 뷰날짜
의 표시와 선택만을 위해 사용calendarView.visibleDateComponents = DateComponents(calendar: Calendar(identifier: .gregorian), year: 2022, month: 6, day: 6)
availableDateRange
프로퍼티
DateInterval
타입
let fromDateComponents = DateComponents(calendar: Calendar(identifier: .gregorian), year: 2022, month: 1, day: 1)
let toDateComponents = DateComponents(calendar: Calendar(identifier: .gregorian), year: 2022, month: 12, day: 31)
guard let fromDate = fromDateComponents.date, let toDate = toDateComponents.date else {
return
}
let calendarViewDateRange = DateInterval(start: fromDate, end: toDate)
calendarView.availableDateRange = calendarViewDateRange
잠시 skip
selectionBehavior
에 할당let dateSelection = UICalendarSelectionSingleDate(delegate: self)
calendarView.selectionBehavior = dateSelection
dateSelection.selectedDate(DateComponents(calendar: Calendar(identifier: .gregorian), year:2022, month: 6, day: 6))
func dateSelection(_ selection: UICalendarSelectionSingleDate, canSelectDate dateComponents: DateComponents?) -> Bool {
// Return `true` to allow a date selection; a nil date clears the selection.
// Require a date selection by returning false if dateComponents is nil.
return dateComponents != nil
}
모던 컬렉션 뷰
디폴데이터소스 =
wwdc는 선택이 아님