Skip to content

Commit da7a79b

Browse files
authored
Decode attributes with no values to empty strings (#1285)
1 parent cb42434 commit da7a79b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/LiveViewNative/Property Wrappers/Attribute.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ extension Optional: AttributeDecodable where Wrapped: AttributeDecodable {
199199
/// Decodes a string from an attribute, if the attribute is present.
200200
extension String: AttributeDecodable {
201201
public init(from attribute: LiveViewNativeCore.Attribute?, on element: ElementNode) throws {
202-
guard let attributeValue = attribute?.value else { throw AttributeDecodingError.missingAttribute(Self.self) }
203-
self = attributeValue
202+
guard let attribute else { throw AttributeDecodingError.missingAttribute(Self.self) }
203+
self = attribute.value ?? ""
204204
}
205205
}
206206

0 commit comments

Comments
 (0)