DeveloperAcademy-POSTECH / DeveloperAcademy-POSTECH/swift-style-guide
[내용 추가] Naming convention for the delegates and the data sources methods
- Dominant language
- No language data
- Stars
- 272
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
### 이슈 중복 확인
확인했습니다
### 카테고리
델리게이트
---
```swift
protocol UserTableViewDelegate {
func tableView(
_ tableView: UITableView,
willDisplayCell cell: Cell,
cellForRowAt indexPath: IndexPath)
)
func tableView(
_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int
)
}
```
delegate 역할, dataSource 역할에 따른 네이밍 규칙을 명시해주면 좋을 것 같습니다.
e.g., When naming the data source method, please make sure that the second parameter name ends in a *noun* form. For example, when the data source method returns the **number of rows in the specific section**, you should name it like `tableView(_:numberOfRowsInSection:)` -> *This allows you to infer what value the method returns.*
e.g., When naming the data source method, please make sure that the second parameter name ends in a *verb* form. For example, `myTableView(_:didTapCell:forRowAt:)`, `myTableView(_:willDisplayCell:forRowAt:)`
Contributor guide
Assessment
This issue has not been assessed yet.