NEULiee / iOS-App-Dev-Tutorials

Apple 개발자 홈페이지의 UIKit 튜토리얼을 보고 정리하는 repository 입니다.
0 stars 0 forks source link

4. Adding, Deleting, and Filtering Reminders #8

Closed NEULiee closed 2 years ago

NEULiee commented 2 years ago

Adding and Deleting Reminders

NEULiee commented 2 years ago

Adding and Deleting Reminders

Learned

  1. Create an Add Action

    • [weak Self] 를 클로저의 capture list에 추가하여 reminder view controller가 reminder list view controller에 대한 강력한 참조를 capture하고 저장하지 못하도록 합니다.
  2. Connect the Target-Action Pair

    • UIBarButtonItem.accessibility~~~
    • accessibilityLabel voiceOver 사용자들은 이 값을 듣게됩니다
  3. Add a New Reminder to the Model

  4. Delete a Reminder

    • swipe-to-delete

    • UISwipeActionsConfiguration(style:, title:) style의 background 속성을 설정하여 custom할 수 있습니다.

    • UICollectionViewLayoutListConfiguration

      • leadingSwipeActionsConfigurationProvider
        • trailingSwipeActionsConfigurationProvider

    블로그

NEULiee commented 2 years ago

Filtering Reminders

  1. Create a List Style Enumeration

    • Locale.current.calendar.isDateInToday(_ date:) 오늘이면 True
  2. Filter Reminders by List Style

  3. Display a Segmented Control

    • UISegmentedControl
  4. Add Action to Segmented Control

    • UISegmentedControl.addTarget(_:action:for:)

UISegmentedControl - 블로그


Quiz

Q. Which UISegmentedControl property identifies the index of the segment that the user most recently selected? A. selectedSegmentIndex

Q. Which method loops over a collection and returns an array that contains only those elements that satisfy a condition? A. filter(_:)

Q. What is the value of priority in this code snippet?

enum TaskPriority: Int {
   case low
   case medium
   case high
   case urgent
}

let priority = TaskPriority(rawValue: 3) ?? .low

A. TaskPriority.urgent