Observable file changes in app groups container with Combine
ObservableAppGroups
Sample project for observable file changes in app groups container with Combine.
Overview
This project contains 3 local packages to manage files in container. (See Packages/Package.swift
)
FileObserver
- Class to observe file changes using DispatchSourceFileSystemObject.
AppGroupsFileSystem
- App groups container url provider and class representing file contained on app groups container.
BroadcastPreferences
- Informations shared and observed between application and app extension.
Broadcast upload extension updates shared Bool variable isBroadcasting
.
try? BroadcastPreferences.shared.isBroadcasting.write(true)
Application observes isBroadcasting
with SwiftUI.
Text(viewModel.isBroadcasting ? "Broadcasting" : "Not Broadcasting")