Skip to content
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

Avoid AnyView in the Counter code #168

Merged
merged 8 commits into from
Jul 16, 2020
Merged

Avoid AnyView in the Counter code #168

merged 8 commits into from
Jul 16, 2020

Conversation

MaxDesiatov
Copy link
Collaborator

@MaxDesiatov MaxDesiatov commented Jul 7, 2020

It's not needed there as ViewBuilder is smarter now.

The macOS SwiftUI SDK even with Xcode 12 still doesn't have the @ViewBuilder attribute on the View protocol, so we have to build for iOS on CI to make the native buld pass.

Resolves #167, which wasn't caused by protocol conformance problems, but by infinite recursion in the _ConditionalContent implementation of body.

Adds assorted formatting fixes, some are apparently caused by the newer swiftformat version.

It's not needed there as `ViewBuilder` is smarter now.
@MaxDesiatov MaxDesiatov added the documentation Technical writing, references, tutorials etc label Jul 7, 2020
@MaxDesiatov MaxDesiatov requested review from carson-katri and j-f1 and removed request for carson-katri and j-f1 July 7, 2020 23:15
@MaxDesiatov MaxDesiatov marked this pull request as draft July 7, 2020 23:19
@@ -45,15 +45,16 @@ struct Counter: View {
let limit: Int

var body: some View {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need @ViewBuilder here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I forgot to commit it 🤦‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed as @ViewBuilder is already on the body declaration of the View protocol.

Sources/TokamakDemo/Counter.swift Show resolved Hide resolved
@MaxDesiatov
Copy link
Collaborator Author

MaxDesiatov commented Jul 7, 2020

Huh, so applying this change actually introduces crashes similar to #167. There definitely is some incompatibility between _ConditionalContent and the runtime library 🤔

UPDATE: the runtime library is not related, this was an infinite recursion problem.

@MaxDesiatov MaxDesiatov marked this pull request as ready for review July 16, 2020 18:01
@MaxDesiatov MaxDesiatov requested review from carson-katri and j-f1 July 16, 2020 18:01
@MaxDesiatov MaxDesiatov merged commit 8f23ac9 into main Jul 16, 2020
@MaxDesiatov MaxDesiatov deleted the refine-counter branch July 16, 2020 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Technical writing, references, tutorials etc
Development

Successfully merging this pull request may close these issues.

Crash in protocol conformance code
2 participants