-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Crash when using .debug #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @ndistqt, thanks for the report! This is a bummer, but we seen some weird behavior in Swift's mirror before, especially when dealing with types from some of Apple's frameworks. I see the value here is an |
I may need to see more of your state/actions that is causing this because locally it seems that func testAXUIElement() {
let element = AXUIElementCreateApplication(1)
XCTAssertEqual(
debugOutput(element),
"""
"""
)
} |
Are you able to reproduce this problem in some code that I can run locally? Also what is |
"Are you able to reproduce this problem in some code that I can run locally?"
UIElement is from the library AXSwift, which you can find here on github, it's just a wrapper around Apple's accessibility API for better ergonomics. |
Hey @ndistqt we took a quick look at AXSwift and it looks like the In general we think that state needs to consist of simple value types, and as soon as you introduce classes and objects you expose yourself to a lot of undefined behavior that will be difficult to test. If you need parts of these classes in your state we recommend defining structs that hold just the value-based data you care about. It can sometimes be a bit of a pain to add this boilerplate, but it will give you peace of mind that your system is working in a predictable manner. |
I'm sure it's an obvious mistake on my part and I had no problems before, but I wasn't able to identify the offending code that causes .debug() to result in following error:

As soon as I remove .debug() everything works like charm.
The text was updated successfully, but these errors were encountered: