- ncn ios team 사용하는
swift
언어의 style-guide, xcode 셋팅, lint config file, format config file을 공유 - SwiftStyleGuide 에 자세히 설명한다.
brew install swiftlint
brew install swift-format
- formatter 로 애플의
swift-format
을 사용한다.SwiftFormat
과 햇갈리지 말자
- Project setting -> Text Setting에서 Spaces, Width의 Tab 2, Indent 2로
- Xcode 설정에서 Text Editing ▸ Editing 선택후 Including whitespace-only lines 을 체크
To simplify the process for everyone in the content pipeline, you'll need to add the necessary instructions to your sample project to run SwiftLint automatically on each build. To do so:
- Select the project document in the Project navigator.
- Select the Build Phases tab.
- Click + and choose New Run Script Phase.
- Drag the new phase before the Compile Sources phase.
- Click the disclosure triangle on the Run Script phase and ensure Shell is set to /bin/sh.
- Add the following script:
PATH=/opt/homebrew/bin:$PATH
if [ -f ~/ncn.swiftlint.yml ]; then
if which swiftlint >/dev/null; then
swiftlint --no-cache --config ~/ncn.swiftlint.yml
fi
fi
- https://github.com/apple/swift-format
- https://swift-format.com/
- format config 파일을 미리보기 할 수 있다
- https://exyte.com/blog/how-to-start-working-with-swift-format