Q:

Can date components be nil if explicity requesting the component?

I am wondering if it is okay to force unwrap here:
let components = calendar.dateComponents([.day], from: from, to: to)

return components.day!

A:

Yes, that is completely safe. All component properties of DateComponents (such as day, month, etc.) are Optional, since you can create DateComponents instances consisting of only a subset of components.
However, a Date object always contains all DateComponents and hence when you request the value of a specific component from a Date using Calendar.dateComponents, it is guaranteed to contain the requested component. So it is safe to force unwrap that component.
On the other hand, if you tried accessing a component of DateComponents that you didn't request with Calendar.dateComponents, that would be nil. See the example below.
let components = Calendar.current.dateComponents([.day], from: Date())
components.day // 13
components.month // nil

