프로그래밍/Swift

[Swift] Using SVG file in Xcode (엑스코드에서 SVG파일 사용하기)

jaeni 2020. 7. 11. 23:29
반응형

결론부터 말하면 SVG는 안된다.

안드로이드(AOS)를 쓰던 나는 SVG를 사용하는게 익숙해서 이걸 쓰고 싶어서

어디는 fileType을 SVG로 바꾸면 된데서 XCode Attribute창을 뒤졌는데 나오긴 개뿔 업데이트하고 없어진듯.

 

1. 암튼 SVG파일을 Xcode에서 사용하고싶으면 SVG를 PDF로 변환해야한다.

아래 페이지에서 변환이 가능하다.

https://cloudconvert.com/

 

CloudConvert

Compress Merge Capture Website Create Archive Extract Archive Convert +200 Formats Supported CloudConvert is your swiss army knife for file conversions. We do support nearly any audio, video, document, ebook, archive, image, spreadsheet or presentation for

cloudconvert.com

2. SVG파일을 PDF파일로 변환했다면 Img Asset을 새로 추가하고 설정을 바꿔준다.

처음 만들면 이런게 뜨는데 이거를

Attribute 창에서 Resizing - Preserve Vector Data를 체크하고

Scales 에서 Single Scale로 바꿔준다.

 

3. 그런 다음 1에서 변환한 pdf 파일을 넣어주면 끝.

기존 에셋을 사용하는 방법대로 사용하면 잘 뜬다.

 

참고

- https://www.freecodecamp.org/news/how-to-upload-images-to-xcode/

반응형