티스토리 뷰
/Users/dream/Documents/for_update/XSign_frame/Swift/MagicXSignV2/MagicXSignV2/SwiftSource/Main.swift:19:20: warning: public class 'MagicXSignV2.MagicXSignV2' shadows module 'MagicXSignV2', which may cause failures when importing 'MagicXSignV2' or its clients in some configurations; please rename either the class 'MagicXSignV2.MagicXSignV2' or the module 'MagicXSignV2', or see https://github.com/apple/swift/issues/56573 for workarounds
요즘 죄다 에러글이긴 하지만
그럼에도 늘 새로운 오류가 나오는 법이죠
문제 상황
클래스 이름을 모듈 이름과 동일하게 한 경우 노란색으로 처음에 경고 뜹니다만
실제로 저 모듈을 만들고 막상 쓰려면 사용 불가 수준의 모듈이 됩니다.
경고 문구
- 파일경로/파일이름.swift:19:20: warning: public class 'Name' shadows module 'Name', which may cause failures when importing 'Name' or its clients in some configurations; please rename either the class 'Name' or the module 'Name', or see https://github.com/apple/swift/issues/56573 for workarounds
해결법
방법은 진짜 간단합니다. 겹치는 이름 둘중 하나를 바꾸면 됩니다.
클래스 이름을 바꾸든 모듈 이름을 바꾸든 하시면 됩니다.
(저는 모듈 이름 바꾸는 김에 전체 프로젝트 이름을 바꾸었습니다.)
참고로 저같은 분이 계실까봐 말씀드리면
만약 본인이 프로젝트 이름을 바꾼다 하시면
BuildSetting에 적힌 경로랑 각종 import 할때 쓰는 이름,modulemap 에 적힌 이름 기타 등등
모든 것을 싹다 바꾸셔야 하니 저처럼 하나 안바꾼거 모르고 시간 버리지 않길 바랍니다.