Skip to content

Regression in SwiftUI in Xcode 14 #1204

Closed Answered by mackoj
mackoj asked this question in Q&A
Jul 12, 2022 · 3 comments · 15 replies
Discussion options

You must be logged in to vote

Apple did respond this morning I think this could help.

Engineering has provided the following information regarding this issue:

We suggest that you refactor views that have WithViewStore call into a separate method:

Current project:

public var body: some View {
WithViewStore(self.store) { viewStore in
{INNER BODY}
}
}
`

New dedicated body function which accepts ViewStore and moves {INNER BODY} into it:

public var body: some View {
WithViewStore(self.store) { viewStore in
body(viewStore: viewStore)
}
}

func body(viewStore: ViewStore<{STATE}, {ACTION}>) -> some View {
{INNER BODY}
}

Also, please know that the performance problem is related to how result builders work and the fact that Wit…

Replies: 3 comments 15 replies

Comment options

You must be logged in to vote
10 replies
@tgrapperon
Comment options

@tgrapperon
Comment options

@tgrapperon
Comment options

@mackoj
Comment options

@tgrapperon
Comment options

Answer selected by mackoj
Comment options

You must be logged in to vote
4 replies
@mackoj
Comment options

@mbrandonw
Comment options

@mbrandonw
Comment options

@mackoj
Comment options

Comment options

You must be logged in to vote
1 reply
@stephencelis
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants