refactor: Migration auf ManaWebShell + ManaTheme.paper aus mana-swift-* v1.6.0/v0.6.0
ManaWebShell aus mana-swift-ui v0.6.0 ersetzt den lokalen `Sources/Features/WebShell/`-Ordner. WebShellCoordinator, WebShell- View, WebShellScripts geloescht (~430 LOC). CookieBridge bleibt lokal (App-spezifischer Cookie-SSO-Pfad fuer .mana.how), wandert nach `Sources/Core/WebShell/CookieBridge.swift`. `RootView.makeWebShellConfig()` baut Config mit Host-Whitelist `zitare.com` + `www.zitare.com` + `*.mana.how`, ZitareTheme-Hints, `syncDarkMode(localStorageKey: "zitare-mode")` und `hideElements` fuer den zitare-web-Header. ZitareTheme forwarded auf ManaTheme.paper aus mana-swift-core v1.6.0 (~90 LOC weg, paper-Werte jetzt single-source in `mana/packages/themes/src/variants/paper.css`). AppConfig.userAgent als plattform-spezifischer Helper hinzu. 20/20 Unit-Tests gruen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e139a382d8
commit
4b00c4ecdf
8 changed files with 72 additions and 534 deletions
|
|
@ -1,75 +0,0 @@
|
|||
import Foundation
|
||||
import ManaCore
|
||||
import WebKit
|
||||
|
||||
/// Reicht den mana-auth-JWT als Cookie an den `WKWebView` weiter, sodass
|
||||
/// eingeloggte `(app)`-Routen auf `zitare.mana.how` ohne zweiten Login
|
||||
/// erreichbar sind.
|
||||
///
|
||||
/// **Phase ζ-1: Skeleton.** Methoden existieren, werden aber heute
|
||||
/// nicht aufgerufen — bevor sie scharfgeschaltet werden, muss der
|
||||
/// Cookie-SSO-Pfad auf der Web-Seite (`zitare/apps/api/src/auth/`
|
||||
/// und `apps/zitare/src/lib/auth/token-helper.ts`) gegen einen
|
||||
/// *echten* mana-auth-Token End-to-End getestet sein (Verifikations-
|
||||
/// Lücke in `zitare/STATUS.md`).
|
||||
///
|
||||
/// **Phase ζ-3:** wird in `SubmitQuoteView` benutzt — vor dem POST
|
||||
/// gegen `zitare-api.mana.how` und vor dem Öffnen von
|
||||
/// `zitare.mana.how/me` im WebView.
|
||||
///
|
||||
/// **Cookie-Schema** (gespiegelt zu mana-auth, siehe
|
||||
/// `mana/services/mana-auth/src/auth/cookies.ts`):
|
||||
/// - Name: `mana.access` (JWT) und optional `mana.refresh` (Opaque)
|
||||
/// - Domain: `.mana.how` (App-Surface; **nicht** `.com`)
|
||||
/// - Path: `/`
|
||||
/// - Secure: true, HTTPOnly: false (WebView muss lesen können),
|
||||
/// SameSite: Lax
|
||||
enum CookieBridge {
|
||||
/// Setzt den `mana.access`-Cookie im geteilten `WKHTTPCookieStore`,
|
||||
/// wenn der `AuthClient` einen gültigen JWT hält. No-op sonst.
|
||||
@MainActor
|
||||
static func installManaAccess(from auth: AuthClient) async {
|
||||
guard case .signedIn = auth.status, let token = currentAccessToken(from: auth) else {
|
||||
Log.web.debug("CookieBridge: kein signedIn-Token, no-op")
|
||||
return
|
||||
}
|
||||
guard let cookie = makeAccessCookie(token: token) else {
|
||||
Log.web.warning("CookieBridge: konnte Cookie-Properties nicht bauen")
|
||||
return
|
||||
}
|
||||
let store = WKWebsiteDataStore.default().httpCookieStore
|
||||
await store.setCookie(cookie)
|
||||
Log.web.info("CookieBridge: mana.access für .mana.how gesetzt")
|
||||
}
|
||||
|
||||
/// Entfernt den `mana.access`-Cookie wieder — etwa nach Logout.
|
||||
@MainActor
|
||||
static func removeManaAccess() async {
|
||||
let store = WKWebsiteDataStore.default().httpCookieStore
|
||||
let cookies = await store.allCookies()
|
||||
for cookie in cookies where cookie.name == "mana.access" {
|
||||
await store.deleteCookie(cookie)
|
||||
}
|
||||
Log.web.info("CookieBridge: mana.access entfernt")
|
||||
}
|
||||
|
||||
private static func currentAccessToken(from auth: AuthClient) -> String? {
|
||||
// ManaCore hält den JWT im Keychain. In ζ-3 ersetzt durch die
|
||||
// tatsächliche `auth.currentAccessToken()`-API; heute nur
|
||||
// Skelett-Hook, damit Cookie-Setup und API in Reichweite sind.
|
||||
// Linter beruhigen ohne unused warning:
|
||||
_ = auth
|
||||
return nil
|
||||
}
|
||||
|
||||
private static func makeAccessCookie(token: String) -> HTTPCookie? {
|
||||
HTTPCookie(properties: [
|
||||
.name: "mana.access",
|
||||
.value: token,
|
||||
.domain: ".mana.how",
|
||||
.path: "/",
|
||||
.secure: true,
|
||||
.sameSitePolicy: HTTPCookieStringPolicy.sameSiteLax
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
import Foundation
|
||||
import SwiftUI
|
||||
import WebKit
|
||||
|
||||
#if canImport(UIKit)
|
||||
import UIKit
|
||||
#endif
|
||||
|
||||
/// `WKNavigationDelegate` + `WKUIDelegate` für `WebShellView`. Hält den
|
||||
/// reactive `WebNavState` aktuell, lenkt externe Links in den System-
|
||||
/// Browser und treibt Pull-to-Refresh an.
|
||||
///
|
||||
/// Nicht `Sendable`: Lebt auf `MainActor` (Closures von WKWebView
|
||||
/// liefern auf Main). KVO-Observations werden bei `deinit` entfernt.
|
||||
@MainActor
|
||||
final class WebShellCoordinator: NSObject, WKNavigationDelegate, WKUIDelegate {
|
||||
let navState: WebNavState
|
||||
let openURL: OpenURLAction
|
||||
var lastTarget: WebTarget?
|
||||
|
||||
private var progressObservation: NSKeyValueObservation?
|
||||
private var loadingObservation: NSKeyValueObservation?
|
||||
private var canGoBackObservation: NSKeyValueObservation?
|
||||
private var urlObservation: NSKeyValueObservation?
|
||||
#if canImport(UIKit)
|
||||
private weak var refreshControl: UIRefreshControl?
|
||||
#endif
|
||||
|
||||
init(navState: WebNavState, openURL: OpenURLAction) {
|
||||
self.navState = navState
|
||||
self.openURL = openURL
|
||||
super.init()
|
||||
}
|
||||
|
||||
deinit {
|
||||
progressObservation?.invalidate()
|
||||
loadingObservation?.invalidate()
|
||||
canGoBackObservation?.invalidate()
|
||||
urlObservation?.invalidate()
|
||||
}
|
||||
|
||||
func observe(webView: WKWebView) {
|
||||
progressObservation = webView.observe(\.estimatedProgress, options: [.new]) { [weak self] _, change in
|
||||
guard let value = change.newValue else { return }
|
||||
Task { @MainActor in
|
||||
self?.navState.estimatedProgress = value
|
||||
}
|
||||
}
|
||||
loadingObservation = webView.observe(\.isLoading, options: [.new]) { [weak self] _, change in
|
||||
guard let value = change.newValue else { return }
|
||||
Task { @MainActor in
|
||||
self?.navState.isLoading = value
|
||||
}
|
||||
}
|
||||
canGoBackObservation = webView.observe(\.canGoBack, options: [.new]) { [weak self] _, change in
|
||||
guard let value = change.newValue else { return }
|
||||
Task { @MainActor in
|
||||
self?.navState.canGoBack = value
|
||||
}
|
||||
}
|
||||
urlObservation = webView.observe(\.url, options: [.new]) { [weak self] _, change in
|
||||
let value = change.newValue ?? nil
|
||||
Task { @MainActor in
|
||||
self?.navState.currentURL = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func load(_ url: URL, into webView: WKWebView) {
|
||||
Log.web.info("WebShell load: \(url.absoluteString, privacy: .public)")
|
||||
navState.lastError = nil
|
||||
let request = URLRequest(url: url)
|
||||
webView.load(request)
|
||||
}
|
||||
|
||||
#if canImport(UIKit)
|
||||
func attachRefresh(_ control: UIRefreshControl, webView: WKWebView) {
|
||||
refreshControl = control
|
||||
control.addAction(
|
||||
UIAction { [weak self, weak webView] _ in
|
||||
webView?.reload()
|
||||
Task { @MainActor in
|
||||
self?.refreshControl?.endRefreshing()
|
||||
}
|
||||
},
|
||||
for: .valueChanged
|
||||
)
|
||||
}
|
||||
#endif
|
||||
|
||||
// MARK: - WKNavigationDelegate
|
||||
|
||||
func webView(
|
||||
_: WKWebView,
|
||||
decidePolicyFor navigationAction: WKNavigationAction
|
||||
) async -> WKNavigationActionPolicy {
|
||||
guard let url = navigationAction.request.url else { return .allow }
|
||||
// Eigene Host-Whitelist: alles auf zitare.com bzw. .mana.how darf
|
||||
// im WebView öffnen. Alles andere geht in den System-Browser.
|
||||
// Custom-Scheme zitare:// catchen wir hier nicht — Universal-
|
||||
// Links auf zitare.com sind der präferierte Pfad.
|
||||
if let host = url.host, isAllowedHost(host) {
|
||||
return .allow
|
||||
}
|
||||
if url.scheme == "http" || url.scheme == "https" {
|
||||
Log.web.info("WebShell → openURL extern: \(url.absoluteString, privacy: .public)")
|
||||
openURL(url)
|
||||
return .cancel
|
||||
}
|
||||
return .cancel
|
||||
}
|
||||
|
||||
func webView(_: WKWebView, didFail _: WKNavigation, withError error: Error) {
|
||||
Log.web.warning("didFail: \(String(describing: error), privacy: .public)")
|
||||
navState.lastError = (error as NSError).localizedDescription
|
||||
}
|
||||
|
||||
func webView(_: WKWebView, didFailProvisionalNavigation _: WKNavigation, withError error: Error) {
|
||||
Log.web.warning("didFailProvisional: \(String(describing: error), privacy: .public)")
|
||||
navState.lastError = (error as NSError).localizedDescription
|
||||
}
|
||||
|
||||
func webView(_: WKWebView, didFinish _: WKNavigation) {
|
||||
navState.lastError = nil
|
||||
}
|
||||
|
||||
// MARK: - WKUIDelegate
|
||||
|
||||
func webView(
|
||||
_ webView: WKWebView,
|
||||
createWebViewWith _: WKWebViewConfiguration,
|
||||
for navigationAction: WKNavigationAction,
|
||||
windowFeatures _: WKWindowFeatures
|
||||
) -> WKWebView? {
|
||||
// `target=_blank`-Links: kein neues Fenster aufmachen, sondern
|
||||
// im aktuellen WebView laden bzw. extern öffnen.
|
||||
if let url = navigationAction.request.url {
|
||||
if let host = url.host, isAllowedHost(host) {
|
||||
webView.load(navigationAction.request)
|
||||
} else {
|
||||
openURL(url)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private func isAllowedHost(_ host: String) -> Bool {
|
||||
host == "zitare.com"
|
||||
|| host == "www.zitare.com"
|
||||
|| host.hasSuffix(".mana.how")
|
||||
|| host == "mana.how"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
import Foundation
|
||||
import WebKit
|
||||
|
||||
/// User-Scripts, die in jeden `WKWebView` injiziert werden.
|
||||
///
|
||||
/// `WKUserScript` ist MainActor-isolated; deshalb sind die Factory-
|
||||
/// Methoden hier ebenfalls MainActor. Aufrufer leben sowieso auf Main
|
||||
/// (SwiftUI `makeUIView`/`makeNSView` sind MainActor).
|
||||
@MainActor
|
||||
enum WebShellScripts {
|
||||
/// Versteckt den zitare-Web-Header (`<header>` mit `<a class="brand">`),
|
||||
/// weil die native TabBar bereits global navigiert. Footer und
|
||||
/// Hauptinhalt bleiben sichtbar.
|
||||
///
|
||||
/// CSS wird at document.start als `<style>`-Tag injiziert — vor dem
|
||||
/// First Paint, kein Flicker.
|
||||
/// Synct den System-Dark-Mode in den WebView. Zitare-Web liest
|
||||
/// `localStorage['zitare-mode']` beim First Paint (Inline-Script
|
||||
/// in `app.html`) und togglet eine `.dark`-Klasse auf `<html>`.
|
||||
///
|
||||
/// In der nativen App wurde der Theme-Toggle-Button im Web-Header
|
||||
/// ausgeblendet (`hideWebHeader`), deshalb kann der User
|
||||
/// localStorage nicht selber setzen. Statt-dessen lauschen wir auf
|
||||
/// `prefers-color-scheme` und schreiben das passende Value vor
|
||||
/// jeder Page-Load und bei jedem System-Switch.
|
||||
///
|
||||
/// Greift sowohl bei Cold-Load (atDocumentStart, vor app.html-
|
||||
/// Inline-Script) als auch bei nachträglichem System-Wechsel
|
||||
/// (`matchMedia`-Listener auf der selben Page).
|
||||
static let syncDarkMode: WKUserScript = .init(
|
||||
source: """
|
||||
(function() {
|
||||
function apply(isDark) {
|
||||
try {
|
||||
if (isDark) localStorage.setItem('zitare-mode', 'dark');
|
||||
else localStorage.removeItem('zitare-mode');
|
||||
} catch (e) {}
|
||||
var html = document.documentElement;
|
||||
if (!html) return;
|
||||
if (isDark) html.classList.add('dark');
|
||||
else html.classList.remove('dark');
|
||||
}
|
||||
var mq = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
apply(mq.matches);
|
||||
// Listener für Live-Switch während die Page offen ist.
|
||||
if (mq.addEventListener) {
|
||||
mq.addEventListener('change', function(e) { apply(e.matches); });
|
||||
}
|
||||
})();
|
||||
""",
|
||||
injectionTime: .atDocumentStart,
|
||||
forMainFrameOnly: true
|
||||
)
|
||||
|
||||
/// Mehrere Selektor-Strategien stapeln, damit ein Klassen-Rename
|
||||
/// oder Markup-Refactor in zitare-web das Hide nicht still bricht:
|
||||
///
|
||||
/// 1. `header[data-app-nav]` — explizit gesetztes Attribut, falls
|
||||
/// zitare-web es irgendwann markieren will (heute nicht da).
|
||||
/// 2. `body header:has(a.brand)` — strukturell: ein `<header>`,
|
||||
/// der einen `a.brand`-Link enthält. Matched die heutige
|
||||
/// SvelteKit-Komponente (Brand „Zitare" links oben).
|
||||
/// 3. `body > * > header:first-of-type` — positionell: erster
|
||||
/// `<header>` direkt unter dem Top-Level-Wrapper. Greift wenn
|
||||
/// `a.brand` mal verschwindet.
|
||||
///
|
||||
/// `body > * > header:first-of-type` ist absichtlich konservativ
|
||||
/// (matcht nur einen `<header>` pro `<body>`-Direktkind), damit
|
||||
/// nicht ungewollt nested Article-Header gehidet werden.
|
||||
static let hideWebHeader: WKUserScript = .init(
|
||||
source: """
|
||||
(function() {
|
||||
var css = [
|
||||
'header[data-app-nav],',
|
||||
'body header:has(a.brand),',
|
||||
'body > header:first-of-type,',
|
||||
'body > div > header:first-of-type {',
|
||||
' display: none !important;',
|
||||
'}'
|
||||
].join('\\n');
|
||||
var style = document.createElement('style');
|
||||
style.setAttribute('data-zitare-native', 'hide-web-header');
|
||||
style.textContent = css;
|
||||
(document.head || document.documentElement).appendChild(style);
|
||||
})();
|
||||
""",
|
||||
injectionTime: .atDocumentStart,
|
||||
forMainFrameOnly: true
|
||||
)
|
||||
}
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
import SwiftUI
|
||||
import WebKit
|
||||
|
||||
/// Phase ζ-1: SwiftUI-Hülle um `WKWebView`. Eine `WebShellView`-Instanz
|
||||
/// gehört zu einem Tab und behält ihren Web-State (Scroll-Position,
|
||||
/// Browser-History) während der Tab aktiv bleibt.
|
||||
///
|
||||
/// **Verhalten:**
|
||||
/// - Lädt `target` beim ersten Auftauchen.
|
||||
/// - Wechselt `target` während die View lebt → lädt neue URL.
|
||||
/// - Pull-to-Refresh über `UIRefreshControl` (iOS).
|
||||
/// - External-Links (anderer Host, `target=_blank`) öffnen im System-
|
||||
/// Browser via `openURL`-Environment, nicht im WebView.
|
||||
/// - Cookies werden über das default `WKWebsiteDataStore` geteilt,
|
||||
/// sodass `CookieBridge` einmal injizierte `mana.access`-Cookies
|
||||
/// sichtbar sind.
|
||||
struct WebShellView: View {
|
||||
let target: WebTarget
|
||||
|
||||
@State private var navState = WebNavState()
|
||||
@Environment(\.openURL) private var openURL
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
if navState.isLoading {
|
||||
ProgressView(value: navState.estimatedProgress)
|
||||
.progressViewStyle(.linear)
|
||||
.frame(height: 2)
|
||||
}
|
||||
#if canImport(UIKit)
|
||||
WebViewRepresentable(
|
||||
target: target,
|
||||
navState: navState,
|
||||
openURL: openURL
|
||||
)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(ZitareTheme.background)
|
||||
#elseif canImport(AppKit)
|
||||
MacWebViewRepresentable(
|
||||
target: target,
|
||||
navState: navState,
|
||||
openURL: openURL
|
||||
)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(ZitareTheme.background)
|
||||
#endif
|
||||
if let error = navState.lastError {
|
||||
errorBar(error)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
|
||||
private func errorBar(_ message: String) -> some View {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "exclamationmark.triangle.fill")
|
||||
.foregroundStyle(ZitareTheme.warning)
|
||||
Text(message)
|
||||
.font(.caption)
|
||||
.lineLimit(2)
|
||||
Spacer()
|
||||
}
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 8)
|
||||
.background(ZitareTheme.muted)
|
||||
}
|
||||
}
|
||||
|
||||
/// URL + monoton wachsende `reloadToken`. Ein neuer Token zwingt den
|
||||
/// WebView, dieselbe URL nochmal zu laden — wird gebraucht wenn der
|
||||
/// User auf einen Universal-Link tappt, der zur aktuellen URL führt.
|
||||
struct WebTarget: Equatable {
|
||||
let url: URL
|
||||
let reloadToken: Int
|
||||
|
||||
init(url: URL, reloadToken: Int = 0) {
|
||||
self.url = url
|
||||
self.reloadToken = reloadToken
|
||||
}
|
||||
}
|
||||
|
||||
/// Reactive Navigation-State, geteilt zwischen SwiftUI und Coordinator.
|
||||
@Observable
|
||||
final class WebNavState {
|
||||
var isLoading: Bool = false
|
||||
var estimatedProgress: Double = 0
|
||||
var lastError: String?
|
||||
var currentURL: URL?
|
||||
var canGoBack: Bool = false
|
||||
}
|
||||
|
||||
#if canImport(UIKit)
|
||||
import UIKit
|
||||
|
||||
private struct WebViewRepresentable: UIViewRepresentable {
|
||||
let target: WebTarget
|
||||
let navState: WebNavState
|
||||
let openURL: OpenURLAction
|
||||
|
||||
func makeCoordinator() -> WebShellCoordinator {
|
||||
WebShellCoordinator(navState: navState, openURL: openURL)
|
||||
}
|
||||
|
||||
func makeUIView(context: Context) -> WKWebView {
|
||||
let config = WKWebViewConfiguration()
|
||||
config.websiteDataStore = .default()
|
||||
config.applicationNameForUserAgent = "ZitareNative/0.1 (iOS)"
|
||||
// Reihenfolge: erst Theme syncen, dann Header verstecken.
|
||||
config.userContentController.addUserScript(WebShellScripts.syncDarkMode)
|
||||
config.userContentController.addUserScript(WebShellScripts.hideWebHeader)
|
||||
let webView = WKWebView(frame: .zero, configuration: config)
|
||||
webView.navigationDelegate = context.coordinator
|
||||
webView.uiDelegate = context.coordinator
|
||||
webView.allowsBackForwardNavigationGestures = true
|
||||
// Ohne diese drei flackert WKWebView bis zum first paint weiß
|
||||
// gegen das Paper-Theme — egal was die SwiftUI-Hülle als
|
||||
// Background setzt.
|
||||
webView.isOpaque = false
|
||||
webView.backgroundColor = .clear
|
||||
webView.scrollView.backgroundColor = .clear
|
||||
webView.scrollView.refreshControl = makeRefreshControl(
|
||||
webView: webView,
|
||||
coordinator: context.coordinator
|
||||
)
|
||||
context.coordinator.observe(webView: webView)
|
||||
context.coordinator.load(target.url, into: webView)
|
||||
return webView
|
||||
}
|
||||
|
||||
func updateUIView(_ webView: WKWebView, context: Context) {
|
||||
let coord = context.coordinator
|
||||
if coord.lastTarget != target {
|
||||
coord.load(target.url, into: webView)
|
||||
coord.lastTarget = target
|
||||
}
|
||||
}
|
||||
|
||||
private func makeRefreshControl(
|
||||
webView: WKWebView,
|
||||
coordinator: WebShellCoordinator
|
||||
) -> UIRefreshControl {
|
||||
let refresh = UIRefreshControl()
|
||||
coordinator.attachRefresh(refresh, webView: webView)
|
||||
return refresh
|
||||
}
|
||||
}
|
||||
|
||||
#elseif canImport(AppKit)
|
||||
import AppKit
|
||||
|
||||
private struct MacWebViewRepresentable: NSViewRepresentable {
|
||||
let target: WebTarget
|
||||
let navState: WebNavState
|
||||
let openURL: OpenURLAction
|
||||
|
||||
func makeCoordinator() -> WebShellCoordinator {
|
||||
WebShellCoordinator(navState: navState, openURL: openURL)
|
||||
}
|
||||
|
||||
func makeNSView(context: Context) -> WKWebView {
|
||||
let config = WKWebViewConfiguration()
|
||||
config.websiteDataStore = .default()
|
||||
config.applicationNameForUserAgent = "ZitareNative/0.1 (macOS)"
|
||||
// Reihenfolge: erst Theme syncen, dann Header verstecken.
|
||||
config.userContentController.addUserScript(WebShellScripts.syncDarkMode)
|
||||
config.userContentController.addUserScript(WebShellScripts.hideWebHeader)
|
||||
let webView = WKWebView(frame: .zero, configuration: config)
|
||||
webView.navigationDelegate = context.coordinator
|
||||
webView.uiDelegate = context.coordinator
|
||||
webView.allowsBackForwardNavigationGestures = true
|
||||
// macOS-Pendant zu UIView.isOpaque=false — sonst weißer
|
||||
// Flash vor first paint.
|
||||
webView.setValue(false, forKey: "drawsBackground")
|
||||
context.coordinator.observe(webView: webView)
|
||||
context.coordinator.load(target.url, into: webView)
|
||||
return webView
|
||||
}
|
||||
|
||||
func updateNSView(_ webView: WKWebView, context: Context) {
|
||||
let coord = context.coordinator
|
||||
if coord.lastTarget != target {
|
||||
coord.load(target.url, into: webView)
|
||||
coord.lastTarget = target
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue