Search code examples
iosgrand-central-dispatchfoundation

What is a practical example using distantFuture?


DispatchTime and (NS)Date have the property distantFuture, which "returns a time in the distant future."

Discussion:

You can pass this value to methods that schedule work to have the system wait indefinitely for a particular event to occur or condition to be met.

I can't think of or find an example where I would actually need to use this. What is a good use case?


Solution

  • For example if you want to retrieve future events from a calendar with an unspecified end date.

    In this case you can set the end date of the predicate to distantFuture.