Default to a `struct` when the value has value semantics and does not need shared identity or inheritance: ```swift struct User { let id: UUID let name: String } ``` Use a `class` when instances must have shared reference identity, participate in an object lifecycle, or use inheritance. Make non-subclassable classes `final`, and prefer `let` properties unless mutation is required. Structs are generally easier to reason about and safer to share across concurrent code.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Swift Best Practices?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-swift-best-practices-6af90ea2)
Default to a `struct` when the value has value semantics and does not need shared identity or inheritance:
```swift
struct User {
let id: UUID
let name: String
}
```
Use a `class` when instances must have shared reference identity, participate in an object lifecycle, or use inheritance. Make non-subclassable classes `final`, and prefer `let` properties unless mutation is required. Structs are generally easier to reason about and safer to share across concurrent code.