diff --git a/Sources/SpeziBluetooth/Model/PropertySupport/DeviceStateAccessor.swift b/Sources/SpeziBluetooth/Model/PropertySupport/DeviceStateAccessor.swift index fb4b3e1..5445471 100644 --- a/Sources/SpeziBluetooth/Model/PropertySupport/DeviceStateAccessor.swift +++ b/Sources/SpeziBluetooth/Model/PropertySupport/DeviceStateAccessor.swift @@ -61,7 +61,7 @@ extension DeviceStateAccessor { /// strictly if the value changes. /// - action: The change handler to register. public func onChange(initial: Bool = false, perform action: @escaping @Sendable (Value) async -> Void) { - onChange(initial: true) { _, newValue in + onChange(initial: initial) { _, newValue in await action(newValue) } } diff --git a/Sources/SpeziBluetooth/Modifier/AutoConnectModifier.swift b/Sources/SpeziBluetooth/Modifier/AutoConnectModifier.swift index 0170665..05ab292 100644 --- a/Sources/SpeziBluetooth/Modifier/AutoConnectModifier.swift +++ b/Sources/SpeziBluetooth/Modifier/AutoConnectModifier.swift @@ -29,8 +29,8 @@ extension View { /// if we don't hear back from the device. Minimum is 1 second. Supply `nil` to use default the default value or a value from the environment. /// - Returns: The modified view. @MainActor - public func autoConnect( // swiftlint:disable:this function_default_parameter_at_end - enabled: Bool = true, + public func autoConnect( + enabled: Bool = true, // swiftlint:disable:this function_default_parameter_at_end with bluetooth: Bluetooth, minimumRSSI: Int? = nil, advertisementStaleInterval: TimeInterval? = nil @@ -60,8 +60,8 @@ extension View { /// if we don't hear back from the device. Minimum is 1 second. Supply `nil` to use default the default value or a value from the environment. /// - Returns: The modified view. @MainActor - public func autoConnect( // swiftlint:disable:this function_default_parameter_at_end - enabled: Bool = true, + public func autoConnect( + enabled: Bool = true, // swiftlint:disable:this function_default_parameter_at_end with bluetoothManager: BluetoothManager, discovery: Set, minimumRSSI: Int? = nil, diff --git a/Sources/SpeziBluetooth/Modifier/ScanNearbyDevicesModifier.swift b/Sources/SpeziBluetooth/Modifier/ScanNearbyDevicesModifier.swift index 629de18..c629c41 100644 --- a/Sources/SpeziBluetooth/Modifier/ScanNearbyDevicesModifier.swift +++ b/Sources/SpeziBluetooth/Modifier/ScanNearbyDevicesModifier.swift @@ -147,8 +147,8 @@ extension View { /// if we don't hear back from the device. Minimum is 1 second. Supply `nil` to use default the default value or a value from the environment. /// - autoConnect: If enabled, the bluetooth manager will automatically connect to the nearby device if only one is found. /// - Returns: The modified view. - public func scanNearbyDevices( // swiftlint:disable:this function_default_parameter_at_end - enabled: Bool = true, + public func scanNearbyDevices( + enabled: Bool = true, // swiftlint:disable:this function_default_parameter_at_end with bluetooth: Bluetooth, minimumRSSI: Int? = nil, advertisementStaleInterval: TimeInterval? = nil, @@ -185,8 +185,8 @@ extension View { /// if we don't hear back from the device. Minimum is 1 second. Supply `nil` to use default the default value or a value from the environment. /// - autoConnect: If enabled, the bluetooth manager will automatically connect to the nearby device if only one is found. /// - Returns: The modified view. - public func scanNearbyDevices( // swiftlint:disable:this function_default_parameter_at_end - enabled: Bool = true, + public func scanNearbyDevices( + enabled: Bool = true, // swiftlint:disable:this function_default_parameter_at_end with bluetoothManager: BluetoothManager, discovery: Set, minimumRSSI: Int? = nil,