Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SwiftUI Performance Notes (Adding as I learn)
- 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