티스토리 뷰

// 웹뷰 약관 보여주기용
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)
  }
}
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함