---
title: warningTime
framework: Device Activity
role: symbol
role_heading: Instance Property
platforms: [iOS 15.0+, iPadOS 15.0+, Mac Catalyst 15.0+]
path: deviceactivity/deviceactivityschedule/warningtime
---

# warningTime

Optional components that generate a warning prior to regularly scheduled events.

## Declaration

```swift
var warningTime: DateComponents? { get }
```

## Discussion

Discussion You can create a warning time to notify your app extension ahead of time before the scheduled activity begins and ends. For instance, when your app schedules activity-monitoring from 10 a.m. to 11 a.m. for an event with a 30-minute threshold, setting the schedule’s warning time to 5 minutes results in the extension receiving intervalWillStartWarning(for:), intervalWillEndWarning(for:), and eventWillReachThresholdWarning(_:activity:) callbacks at 9:55 a.m., 10:55 a.m, and when 25 minutes of the event’s activity occurs, respectively. 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.

## See Also

### Creating a Schedule

- [init(intervalStart:intervalEnd:repeats:warningTime:)](deviceactivity/deviceactivityschedule/init(intervalstart:intervalend:repeats:warningtime:).md)
- [intervalEnd](deviceactivity/deviceactivityschedule/intervalend.md)
- [intervalStart](deviceactivity/deviceactivityschedule/intervalstart.md)
- [nextInterval](deviceactivity/deviceactivityschedule/nextinterval.md)
- [repeats](deviceactivity/deviceactivityschedule/repeats.md)
