This course is available as part of the raywenderlich.com Professional subscription. To learn more click here
Pro

Wrangling Dates & Time in iOS

Mar 11 2021 · Video Course (23 mins) · Advanced

Understanding the deep technical details how dates and time work in iOS is immensely helpful for developing apps—every single day, month, and year! Learn the foundational structures behind working with dates and time in iOS. Then, apply your date modeling to SwiftUI views.

4.9/5 8 Ratings

Version

  • Swift 5, iOS 14, Xcode 12

Wrangling Dates & Time in iOS

TimeInterval

2:43 Free

TimeInterval is a type alias for Double with a specific meaning: it’s a number of seconds, which is permitted to have a fractional component.

1

Date

2:23

A Date is a specific point in time, independent of any calendar or time zone, that is stored as a number of seconds from a reference.

2

DateComponents are specified in terms of units (e.g. year, month, day, hour, and minute), and are evaluated using a calendar and time zone.

3

Calendar

2:20

Foundation’s Calendar wraps absolute points in time in systems which provide features for calculation and comparison of dates.

4

Locale

3:33

Locales provide information about linguistic, cultural, and technological conventions for use in formatting data for presentation.

5

Calendars employ an enumeration for the various components of their dates, and lists of localized symbol Strings.

6

Foundation’s Date Formatters convert between dates and their textual representations. They provide the human-readable Strings that your users will see.

7

ISO 8601

1:39

ISO 8601 is a widely-used standard for date representation. It’s a human-readable string, but as accurate as a TimeInterval instance.

8

DatePicker

1:41

DatePicker is the SwiftUI view which corresponds with everything you’ve learned in this course so far, allowing the user to select a Date.

9

GraphicalDatePickerStyle is used to allow browsing through days in a calendar. If you want a clock, this is the style you need.

10

Who is this for?

This course is designed to clear up common confusion points when working with dates and time in the iOS ecosystem. It will be most useful as a reference if you’re already an experienced iOS developer, but feel free to learn along, if you find it helpful, even as a new developer to the platform. Being very familiar with with Swift and SwiftUI will assist you.

Covered concepts

  • Foundation
  • Date
  • DateComponents
  • Calendar
  • ISO 8601
  • TimeInterval
  • DatePicker

Contributors

Comments