티스토리 뷰
SwiftUI의 Form의 배경색상을 얻는 방법은 다음 사이트에서 잘 설명해주고 있다.
https://sarunw.com/posts/dark-color-cheat-sheet/
나는 Form의 배경색상을 얻는 방법을 원했다.
일반 배경은 .systemBackground라는 하나의 색상이 사용된다.
하지만 Form은 그룹 색상이 있기 때문에 두 개의 색상이 사용된다.
.systemGroupedBackground가 배경 색상이 되고, .secondarySystemGroupedBackground가 그룹의 배경 색상이 된다.
SwiftUI에서는 UIColor 대신 Color를 사용하므로 Color(uiColor:)를 이용해서 다음과 같이 사용할 수 있다.
Color(uiColor: .systemGroupedBackground)
'SwiftUI > Views' 카테고리의 다른 글
[SwiftUI] @ViewBuilder (0) | 2023.08.26 |
---|---|
[SwiftUI] TextEditor 배경색 변경하기 (0) | 2023.08.26 |
[SwiftUI] 페이지 뷰 만들기 (0) | 2023.08.24 |
[SwiftUI] EditButton 사용 시, EditMode 감지하기 (0) | 2023.08.23 |
[SwiftUI] Label의 스타일 커스텀하기 (0) | 2023.08.23 |
댓글