Contents

predicateForSamples(withStart:end:options:)

Returns a predicate for samples whose start and end dates fall within the specified time interval.

Declaration

class func predicateForSamples(withStart startDate: Date?, end endDate: Date?, options: HKQueryOptions = []) -> NSPredicate

Parameters

  • startDate:

    The start date for the target time interval.

  • endDate:

    The end date for the target time interval.

  • options:

    A constant that specifies how the sample’s start and end date are compared with the target time interval. For a list of possible values, see Hkqueryoptions.

Return Value

A predicate for samples whose start and end dates fall within the specified time interval. This predicate works only with samples.

Discussion

Use this convenience method to create a predicate that compares a sample’s start and end dates with a specified time interval. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

See Also

Related Documentation

Creating sample predicates