Created
April 16, 2021 12:57
-
-
Save steipete/6c430d08bd57b066fada7628d3b8b719 to your computer and use it in GitHub Desktop.
SwiftUI Performance Notes (Adding as I learn)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Optimize Hashable and Equatable. e.g. if you have an id, just use that - instead of having the system use reflection and diff all properties: | |
public func hash(into hasher: inout Hasher) { | |
hasher.combine(id) | |
} | |
public static func == (lhs: UserBox, rhs: UserBox) -> Bool { | |
return lhs.id == rhs.id | |
} | |
- Use explicit id on ForEach to optimize diffing | |
- Use ViewDebug print tools to notice loops/large rebuilds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment