<aside> 📌 swiftlint를 사용하여 코드 컨벤션을 지킵니다.
</aside>
disabled_rules:
- trailing_whitespace
- force_cast
- force_try
- force_unwrapping
- identifier_name
- line_length
- shorthand_operator
- type_name
- function_parameter_count
- function_body_length
- nesting
- cyclomatic_complexity
- mark
opt_in_rules:
- empty_count
- empty_string
excluded:
- YELLO-iOS/Application
위의 룰을 따릅니다.
// TODO: 앞으로 할 일을 TODO로 적어두기 -> 나중에 꼭 지우기
// MARK: - Variables
// MARK: Constants
// MARK: Property
var index = 0
var nameList: [Name]
// MARK: Component (button, label 등 코드로 만들때)
// MARK: - Function
// MARK: LifeCycle
// MARK: Server Helpers
// MARK: Layout Helpers
// MARK: Custom Function
// MARK: Objc Function
// MARK: - Protocol
// MARK: - extension
// delegate 꼭 Extension 빼기, 마크 주석 달기
// MARK: UICollectionViewDelegateFlowLayout
// MARK: UICollectionViewDataSource
들여쓰기: 1 Tab (띄어쓰기 두번이나 탭 두개 금지)
: 을 쓸 때에는 콜론의 오른쪽에만 공백을 둡니다.
let names: [String: String]?
단, 삼항연산자는 콜론 양 옆에 공백을 둡니다.
isEnable ? print("ok") **:** print("no")
모든 파일은 빈 줄로 끝나도록 합니다.
MARK 구문의 위에만 한 줄 줄바꿈 합니다.
// MARK: - Layout
override func layoutSubviews() {
// doSomething()
}
// MARK: - Actions
override func menuButtonDidTap() {
// doSomething()
}
함수 줄바꿈은 다음과 같이 합니다.
override func layoutSubviews() {
// doSomething()
}
함수 정의가 너무 길어지면 다음과 같이 줄바꿈합니다.
파라미터 기준으로 줄바꿈하며, 리턴은 따로 줄바꿈하지 않습니다.
func collectionView(_ collectionView: UICollectionView,
cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
// doSomething()
}
함수 아래 한 칸, 클래스 아래 한 칸을 줄바꿈하며 의미없는 공백을 만들지 않습니다.
func 함수1() {
}
func 함수2() {
}