Protocols define a behavioral contract and support composition; class inheritance reuses implementation through a reference-type hierarchy. ```swift protocol Payable { func pay() } struct Invoice: Payable { func pay() { /* ... */ } } class BaseController { } final class CheckoutController: BaseController { } ``` Prefer protocol composition and structs for decoupling and value semantics. Use class inheritance when shared reference identity or inherited implementation is genuinely required, and...
Scanned 9/5/2026
Install to Claude Code
npx -y skills add HoangNguyen0403/agent-skills-standard --skill swift-language --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Swift Language?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-swift-language-0554d01b)More formats (shields.io, HTML) on the badges page.
Protocols define a behavioral contract and support composition; class inheritance reuses implementation through a reference-type hierarchy.
```swift
protocol Payable { func pay() }
struct Invoice: Payable {
func pay() { /* ... */ }
}
class BaseController { }
final class CheckoutController: BaseController { }
```
Prefer protocol composition and structs for decoupling and value semantics. Use class inheritance when shared reference identity or inherited implementation is genuinely required, and mark classes `final` when they are not designed for subclassing.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!