퍼블리셔/SwiftUI
[Swift UI] cornerRadius 적용시 모서리 사라지는 문제해결
영니_
2021. 11. 1. 11:09
반응형
border를 준 부분에 cornerRadius를 적용하면 모서리가 사라지는 모습을 아래처럼 볼 수 있는데
//모서리 사라지는 소스
SecureField("현재 비밀번호", text: $password)
.padding(EdgeInsets(top:18,leading:20,bottom:18,trailing:20))
.font(.custom("SpoqaHanSansNeo-Regular",size:16))
.border(Color("gray8"),width:1)
.cornerRadius(8)
background컬러가 아닌 border가 들어가는 부분에 radius를 적용하기 위해서는
cornerRadius가 아닌RoundedRectangle를 overlay해야 합니다.
적용된 모습은 아래와 같습니다.
SecureField("현재 비밀번호", text: $currentPw)
.padding(EdgeInsets(top:18,leading:20,bottom:18,trailing:20))
.font(.custom("SpoqaHanSansNeo-Regular",size:16))
.foregroundColor(Color("gray6"))
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(Color("gray8"),lineWidth:1)
)
반응형