Skip to content

Commit 5705b9d

Browse files
committed
fix: values should return non-optional P.Value array
1 parent a38022d commit 5705b9d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Sources/FoundationEssentials/ProgressManager/ProgressManager.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ internal struct AnyMetatypeWrapper: Hashable, Equatable, Sendable {
210210
state.otherProperties[AnyMetatypeWrapper(metatype: P.self)] = newValue
211211

212212
// Generate an array of myself + children values of the property
213-
let flattenedChildrenValues: [P.Value?] = {
213+
let flattenedChildrenValues: [P.Value] = {
214214
let childrenDictionary = state.childrenOtherProperties[AnyMetatypeWrapper(metatype: P.self)]
215-
var childrenValues: [P.Value?] = []
215+
var childrenValues: [P.Value] = []
216216
if let dictionary = childrenDictionary {
217217
for (_, value) in dictionary {
218-
if let value = value as? [P.Value?] {
218+
if let value = value as? [P.Value] {
219219
childrenValues.append(contentsOf: value)
220220
}
221221
}
@@ -224,7 +224,7 @@ internal struct AnyMetatypeWrapper: Hashable, Equatable, Sendable {
224224
}()
225225

226226
// Send the array of myself + children values of property to parents
227-
let updateValueForParent: [P.Value?] = [newValue] + flattenedChildrenValues
227+
let updateValueForParent: [P.Value] = [newValue] + flattenedChildrenValues
228228
manager.parents.withLock { [manager] parents in
229229
for (parent, _) in parents {
230230
parent.updateChildrenOtherProperties(property: P.self, child: manager, value: updateValueForParent)
@@ -307,7 +307,7 @@ internal struct AnyMetatypeWrapper: Hashable, Equatable, Sendable {
307307
/// Returns an array of values for specified property in subtree.
308308
/// - Parameter metatype: Type of property.
309309
/// - Returns: Array of values for property.
310-
public func values<P: Property>(of property: P.Type) -> [P.Value?] {
310+
public func values<P: Property>(of property: P.Type) -> [P.Value] {
311311
_$observationRegistrar.access(self, keyPath: \.state)
312312
return state.withLock { state in
313313
let childrenValues = getFlattenedChildrenValues(property: property, state: &state)

Sources/FoundationEssentials/ProgressManager/ProgressReporter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import Observation
5858
/// Returns an array of values for specified property in subtree.
5959
/// - Parameter metatype: Type of property.
6060
/// - Returns: Array of values for property.
61-
public func values<P: ProgressManager.Property>(of property: P.Type) -> [P.Value?] {
61+
public func values<P: ProgressManager.Property>(of property: P.Type) -> [P.Value] {
6262
manager.values(of: property)
6363
}
6464

0 commit comments

Comments
 (0)