[SwiftUI] 이미지를 화면 가득 채우고 싶습니다.
소개
SwiftUI의 이미지 주위를 만지고 있고, 어땠는지 몰랐던 곳을 되도록 과거의 자신에게 알기 쉽게 쓰고 있습니다.
원본 이미지
SwiftUI의 Apple 공식 튜토리얼에서 이미지를 빌렸습니다.

목표
이미지를 화면 가득 채우기
실패 예 ①

ContentView.swift
Image("image")
.resizable()
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
이미지의 종횡비를 무시하고 강제로 크기를 확대했습니다.
하지만 조금 틈이 있습니다.
실패 예②

ContentView.swift
Image("image")
.resizable()
.aspectRatio(contentMode: .fill)
양쪽 끝에 틈이 있습니다.
성공

ContentView.swift
Image("image")
.resizable()
.aspectRatio(contentMode: .fill)
.edgesIgnoringSafeArea(.all)
덤
상태 바를 숨기고 싶을 때

ContentView.swift
Image("image")
.resizable()
.aspectRatio(contentMode: .fill)
.edgesIgnoringSafeArea(.all)
.statusBar(hidden: true)
끝까지 봐 주셔서 감사합니다!
github( htps : // 기주 b. 코 m / 료스케 카미 무라 / 슈 f 드_에 x 텐 d_ )
Reference
이 문제에 관하여([SwiftUI] 이미지를 화면 가득 채우고 싶습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/coffmark/items/dca3bbed65382a1f9a8b텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)