Skip to content

Releases: stefanprojchev/ForgeBackgroundTasks

1.1.0

Choose a tag to compare

@stefanprojchev stefanprojchev released this 17 May 22:24
db63db8

Conventions refactor

Applied the project-wide layered conventions and canonical pragma marks. No public API removals, no behavior changes.

  • BackgroundTask protocol into Domain/Services/BackgroundTasks/.
  • BackgroundTaskContext and BackgroundTaskSchedule value types into Domain/Models/Entities/.
  • BackgroundTaskRegistry implementation into Data/Services/BackgroundTasks/.
  • Normalized pragma marks to canonical Dependencies / Init / Implementation / Private.

1.0.1

Choose a tag to compare

@stefanprojchev stefanprojchev released this 13 May 11:54
16c15aa

Switch local path dependencies (ForgeCore, ForgeObservers) to GitHub-hosted versions so consumers can resolve via SPM.

ForgeBackgroundTasks 1.0.0

Choose a tag to compare

@stefanprojchev stefanprojchev released this 09 Apr 11:27

First public release.

Features

  • BackgroundTaskRegistry — registers tasks with BGTaskScheduler, schedules them, and dispatches system launches to your task implementations. Handles the expiration/completion race with atomic state tracking so you can't double-complete a task.
  • BackgroundTask protocol — identifier, requiresNetwork, requiresProtectedData, schedule, and an execute(context:) method for the actual work.
  • BackgroundTaskSchedule.refresh (BGAppRefreshTaskRequest) and .processing (BGProcessingTaskRequest) variants with interval, network, and charging requirements.
  • BackgroundTaskContext — runtime context with isCancelled closure, connectivity status, and protected-data availability.

Pre-checks

Before calling execute(), the registry checks:

  • Protected data — if the task requiresProtectedData and the device is locked, the launch is skipped and the task is rescheduled.
  • Network — the task's requiresNetwork flag is surfaced to the action via context.connectivity.

Dependency protocols

Takes ConnectivityObserving and ProtectedDataObserving as dependencies, so you can use ForgeObservers or provide your own implementations.

Tests

13 tests covering registration, duplicate handling, concurrent registration, schedule enum, and context propagation.

Requirements

  • iOS 18+
  • Swift 6.3+ (Xcode 26 or later)
  • Task identifiers declared in BGTaskSchedulerPermittedIdentifiers in Info.plist
  • processing background mode (for .processing schedule variants)

Installation

.package(url: "https://github.com/stefanprojchev/ForgeBackgroundTasks.git", from: "1.0.0")

Documentation

Full docs: https://stefanprojchev.github.io/ForgeBackgroundTasks/