본문 바로가기

프로그래밍/Swift

swift-format 에러발생

반응형

에러메시지

<unknown>: error: Unable to format ... The loaded '_InternalSwiftSyntaxParser' library is from a toolchain that is not compatible with this version of SwiftSyntax

 

 

원인 및 해결방법

1. swift-format 버전이 설치된 xcode의 Swift 버전과 호환되지 않는경우
- 해결방법
swift-format 및 xcode 버전 확인 후 swift-format을 적절한 버전으로 업그레이드 하거나 xcode를 적절한 버전으로 다운그레이드
https://github.com/apple/swift-format

 

 

 

2. xcode 파일 경로를 못찾는 경우

- 해결방법

1) xcode의 이름을 xcode_13 과 같이 버전별로 다르게 설정한 경우 swift-format은 경로를 찾지 못하므로 format에 대응하는 xcode는 파일명을 xcode로 유지

2) `xcode > Preferences > Locations > Command Line Tools`에서 커맨드 라인에서 사용될 xcode를 지정

반응형