// 웹뷰 약관 보여주기용
struct PolicyView: UIViewRepresentable {
var policyType: Policy
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
let request = URLRequest(url: policyType.url)
webView.load(request)
return webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {}
class Coordinator {}
func makeCoordinator() -> Coordinator {
return Coordinator()
}
}
enum Policy {
case 이용약관
case 개인정보처리방침
case 마케팅
var resourceName: String {
switch self {
case .이용약관:
return "terms_of_use"
}
}
var url: URL {
let localFilePath = Bundle.main.path(forResource: resourceName, ofType: "html")!
return URL(fileURLWithPath: localFilePath)
}
}