Closed ilendemli closed 1 year ago
Hey @ilendemli,
I'm not fully across the recent changes but using [String:String]()
or .init()
instead of [:]
resolves the error for me.
You can also use .replaceError(with:)
as an alternative to Optionally
+ .map(_:)
if you're providing a default value.
Parse {
Prefix(while: \.isLetter)
.map(.string)
Parse {
Whitespace(1..., .horizontal)
AttributesParser()
}
.replaceError(with: [String: String]())
Whitespace(.horizontal)
}
@iampatbrown Interesting, this seems to be it. I noticed the type of attributes in my map is understandable [String: String]
coming from AttributesParser.Output. So it makes sense to use [String: String]()
. But I would still have expected [:]
to work here.
EDIT: This seems to work as well
.map { attributes -> [String: String] in
attributes ?? [:]
}
Hey! I have a compilation error with the Parser below. This parser worked before 0.12.0 with Xcode 13 and lazy var syntax instead of the new SwiftUI body syntax. I am not sure what the issue is here or what I have to change for this to work.