---
title: "init(fire:interval:repeats:block:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/timer/init(fire:interval:repeats:block:)"
---

# init(fire:interval:repeats:block:)

Initializes a timer for the specified date and time interval with the specified block.

## Declaration

```swift
convenience init(fire date: Date, interval: TimeInterval, repeats: Bool, block: @escaping @Sendable (Timer) -> Void)
```

## Parameters

- `date`: The time at which the timer should first fire.
- `interval`: For a repeating timer, this parameter contains the number of seconds between firings of the timer. If interval is less than or equal to 0.0, this method chooses the nonnegative value of 0.0001 seconds instead.
- `repeats`: If doc://com.apple.documentation/documentation/Swift/true, the timer will repeatedly reschedule itself until invalidated. If doc://com.apple.documentation/documentation/Swift/false, the timer will be invalidated after it fires.
- `block`: A block to be executed when the timer fires. The block takes a single doc://com.apple.foundation/documentation/Foundation/Timer parameter and has no return value.

## Return Value

Return Value A new Timer object, configured according to the specified parameters.

## Discussion

Discussion You must add the new timer to a run loop, using add(_:forMode:). Upon firing, after interval seconds have elapsed, the timer fires, executing block. (If the timer is configured to repeat, you don’t need to add the timer to the run loop again.)

## See Also

### Creating a Timer

- [scheduledTimer(withTimeInterval:repeats:block:)](foundation/timer/scheduledtimer(withtimeinterval:repeats:block:).md)
- [scheduledTimer(timeInterval:target:selector:userInfo:repeats:)](foundation/timer/scheduledtimer(timeinterval:target:selector:userinfo:repeats:).md)
- [scheduledTimer(timeInterval:invocation:repeats:)](foundation/timer/scheduledtimer(timeinterval:invocation:repeats:).md)
- [init(timeInterval:repeats:block:)](foundation/timer/init(timeinterval:repeats:block:).md)
- [init(timeInterval:target:selector:userInfo:repeats:)](foundation/timer/init(timeinterval:target:selector:userinfo:repeats:).md)
- [init(timeInterval:invocation:repeats:)](foundation/timer/init(timeinterval:invocation:repeats:).md)
- [init(fireAt:interval:target:selector:userInfo:repeats:)](foundation/timer/init(fireat:interval:target:selector:userinfo:repeats:).md)
