I am not sure if this should be here or in Swift forum. But I am using SwiftIUI and that is where I am seeing it.
I am looking for confirmation of a problem before I file a bug report with Apple.
I am on XCode Version 12.3 (12C33), on Big Sur (beta). It appears this update of XCode has a bug when using dianostic print statements that contain Bindings of NSAttributedStrings.
I am totally new to NSAttributedString and I am incorporating that into an NSRepresentable NSTextView for formatted text editing. So, being able to print is crucial to understanding what I am doing.
Could someone at the current level of release (same as I am) verify they can (or can't) print a @Binding<NSAttrributedString>, I would appreciate it.
Simple test:
struct ARepresentableView: NSViewRepresentable {
@Binding var aString: NSAttributedString?
func updateNSView(_ view: AnNSView, context: Context) {
print("updateNSView: [\(aString)]")
view.aStr = aString
}
This works with the passed in value of aString. When the value of aString is changed within ARepresentableView, and the udpateNSView is called to refresh it the print state crashes with this:
2020-12-15 09:32:52.030427-0500 Hermes[77309:1627758] [General] *** -[NSBigMutableString substringWithRange:]: Range {27, 49} out of bounds; string length 60