You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.6 KiB

import SwiftUI
import WebKit
struct PrivacyPolicyView: View {
@EnvironmentObject private var languageManager: LanguageManager
var body: some View {
ZStack {
//
LinearGradient(
gradient: Gradient(colors: [
Color(.systemBackground),
Color(.systemGray6).opacity(0.2)
]),
startPoint: .top,
endPoint: .bottom
)
.ignoresSafeArea()
// WebViewHTML
WebView(url: Bundle.main.url(forResource: "privacy_policy", withExtension: "html")!)
.ignoresSafeArea(.container, edges: .bottom)
}
.navigationTitle("privacy_policy".localized)
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackButtonHidden(false)
}
}
// MARK: - WebView
struct WebView: UIViewRepresentable {
let url: URL
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
webView.loadFileURL(url, allowingReadAccessTo: url.deletingLastPathComponent())
webView.scrollView.contentInsetAdjustmentBehavior = .never
webView.scrollView.showsVerticalScrollIndicator = true
webView.scrollView.showsHorizontalScrollIndicator = false
return webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
//
}
}
#Preview {
NavigationView {
PrivacyPolicyView()
.environmentObject(LanguageManager.shared)
}
}