<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeviceActivity",
  "identifier" : "/documentation/DeviceActivity/DeviceActivitySchedule/init(intervalStart:intervalEnd:repeats:warningTime:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Device Activity"
    ],
    "preciseIdentifier" : "s:14DeviceActivity0aB8ScheduleV13intervalStart0D3End7repeats11warningTimeAC10Foundation14DateComponentsV_AJSbAJSgtcfc"
  },
  "title" : "init(intervalStart:intervalEnd:repeats:warningTime:)"
}
-->

# init(intervalStart:intervalEnd:repeats:warningTime:)

Creates a new schedule.

```
init(intervalStart: DateComponents, intervalEnd: DateComponents, repeats: Bool, warningTime: DateComponents? = nil)
```

## Parameters

`intervalStart`

The date components that represent the start time for a schedule’s interval.

`intervalEnd`

The date components that represent the end time for a schedule’s interval.

`repeats`

Indicates whether the schedule recurs. If `false`, the extension
stops receiving callbacks when the interval ends for the first time.

`warningTime`

An optional warning time to receive callbacks.
If the components specify a longer time interval than the schedule’s interval, the system
clamps the warning callbacks for each event’s threshold to the start time of the interval.

## Discussion> Important: If the current date falls in between ``doc://com.apple.DeviceActivity/documentation/DeviceActivity/DeviceActivitySchedule/intervalStart`` and ``doc://com.apple.DeviceActivity/documentation/DeviceActivity/DeviceActivitySchedule/intervalEnd``, the system calls the
> ``doc://com.apple.DeviceActivity/documentation/DeviceActivity/DeviceActivityMonitor/intervalDidStart(for:)`` method immediately upon starting to monitor the activity. If the
> current date doesn’t fall in between `intervalStart` and `intervalEnd`, then `intervalDidStart(for:)`
> calls at the next date matching `intervalStart`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)