Build Information
Failed to build WWMarkdownWebViewUI, reference main (38d61b), with Swift 6.1 for macOS (SPM) on 12 Jul 2026 20:07:04 UTC.
Build Command
env DEVELOPER_DIR=/Applications/Xcode-16.3.0.app xcrun swift build --arch arm64Build Log
========================================
RunAll
========================================
Builder version: undefined version: run 'make version' to update
Interrupt handler set up.
========================================
Checkout
========================================
Clone URL: https://github.com/William-Weng/WWMarkdownWebViewUI.git
Reference: main
Initialized empty Git repository in /Users/admin/builder/spi-builder-workspace/.git/
From https://github.com/William-Weng/WWMarkdownWebViewUI
* branch main -> FETCH_HEAD
* [new branch] main -> origin/main
HEAD is now at 38d61b8 - Update ReadMe
Cloned https://github.com/William-Weng/WWMarkdownWebViewUI.git
Revision (git rev-parse @):
38d61b8aa6d21a4c90815d23c4fbf053ba75f292
SUCCESS checkout https://github.com/William-Weng/WWMarkdownWebViewUI.git at main
========================================
Build
========================================
Selected platform: macosSpm
Swift version: 6.1
Building package at path: $PWD
https://github.com/William-Weng/WWMarkdownWebViewUI.git
https://github.com/William-Weng/WWMarkdownWebViewUI.git
{
"dependencies" : [
],
"manifest_display_name" : "WWMarkdownWebViewUI",
"name" : "WWMarkdownWebViewUI",
"path" : "/Users/admin/builder/spi-builder-workspace",
"platforms" : [
{
"name" : "ios",
"version" : "17.0"
}
],
"products" : [
{
"name" : "WWMarkdownWebViewUI",
"targets" : [
"WWMarkdownWebViewUI"
],
"type" : {
"library" : [
"automatic"
]
}
}
],
"swift_languages_versions" : [
"5"
],
"targets" : [
{
"c99name" : "WWMarkdownWebViewUI",
"module_type" : "SwiftTarget",
"name" : "WWMarkdownWebViewUI",
"path" : "Sources/WWMarkdownWebViewUI",
"product_memberships" : [
"WWMarkdownWebViewUI"
],
"resources" : [
{
"path" : "/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Privacy",
"rule" : {
"copy" : {
}
}
},
{
"path" : "/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Resources/github-markdown.css",
"rule" : {
"process" : {
}
}
},
{
"path" : "/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Resources/markdown.html",
"rule" : {
"process" : {
}
}
},
{
"path" : "/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Resources/marked.umd.js",
"rule" : {
"process" : {
}
}
}
],
"sources" : [
"Utility/Coordinator.swift",
"Utility/Extension.swift",
"Utility/Handler.swift",
"Utility/Manager.swift",
"WWMarkdownWebViewUI.swift"
],
"type" : "library"
}
],
"tools_version" : "5.10"
}
Running build ...
env DEVELOPER_DIR=/Applications/Xcode-16.3.0.app xcrun swift build --arch arm64 -Xswiftc -Xfrontend -Xswiftc -stats-output-dir -Xswiftc -Xfrontend -Xswiftc .stats -Xswiftc -strict-concurrency=complete -Xswiftc -enable-upcoming-feature -Xswiftc StrictConcurrency -Xswiftc -enable-upcoming-feature -Xswiftc DisableOutwardActorInference -Xswiftc -enable-upcoming-feature -Xswiftc GlobalActorIsolatedTypesUsability -Xswiftc -enable-upcoming-feature -Xswiftc InferSendableFromCaptures
Building for debugging...
[0/6] Write sources
[1/6] Copying marked.umd.js
[1/6] Copying github-markdown.css
[2/6] Copying markdown.html
[4/6] Copying Privacy
[5/6] Write swift-version-2F0A5646E1D333AE.txt
[7/13] Compiling WWMarkdownWebViewUI Manager.swift
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:32:22: warning: 'try' must precede 'await'
30 | guard let webView = webView else { return nil }
31 |
32 | let result = await try webView.evaluateJavaScript("getTextContent()")
| `- warning: 'try' must precede 'await'
33 | return result as? String
34 | }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:42:22: warning: 'try' must precede 'await'
40 | guard let webView = webView else { return nil }
41 |
42 | let result = await try webView.evaluateJavaScript("getHtmlContent()")
| `- warning: 'try' must precede 'await'
43 | return result as? String
44 | }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
10 |
11 | // 管理 WebView 和 JS 結果的 ObservableObject
12 | public extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
16 |
macro expansion @Observable:1:2: error: 'ObservationTracked()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:9: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @Observable ------------------------------------
|1 | @ObservationTracked
| | `- error: 'ObservationTracked()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
macro expansion @Observable:1:2: error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:20:5: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
18 |
19 | public init() {}
20 | }
+--- macro expansion @Observable ------------------------------------
| 1 | @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
| | `- error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
| 2 |
| 3 | internal nonisolated func access<Member>(
+--------------------------------------------------------------------
21 | }
22 |
macro expansion @ObservationTracked:1:2: error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:39: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @ObservationTracked ----------------------------
|1 | @ObservationIgnored private var _webView: WKWebView?
| | `- error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
macro expansion @Observable:1:70: error: 'ObservationRegistrar' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:20:5: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
18 |
19 | public init() {}
20 | }
+--- macro expansion @Observable ------------------------------------
| 1 | @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
| | `- error: 'ObservationRegistrar' is only available in macOS 14.0 or newer
| 2 |
| 3 | internal nonisolated func access<Member>(
+--------------------------------------------------------------------
21 | }
22 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
error: emit-module command failed with exit code 1 (use -v to see invocation)
[8/13] Compiling WWMarkdownWebViewUI Handler.swift
[9/13] Compiling WWMarkdownWebViewUI resource_bundle_accessor.swift
[10/13] Compiling WWMarkdownWebViewUI Extension.swift
[11/13] Emitting module WWMarkdownWebViewUI
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
10 |
11 | // 管理 WebView 和 JS 結果的 ObservableObject
12 | public extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
16 |
macro expansion @Observable:1:2: error: 'ObservationTracked()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:9: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @Observable ------------------------------------
|1 | @ObservationTracked
| | `- error: 'ObservationTracked()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
macro expansion @Observable:1:2: error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:20:5: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
18 |
19 | public init() {}
20 | }
+--- macro expansion @Observable ------------------------------------
| 1 | @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
| | `- error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
| 2 |
| 3 | internal nonisolated func access<Member>(
+--------------------------------------------------------------------
21 | }
22 |
macro expansion @ObservationTracked:1:2: error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:39: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @ObservationTracked ----------------------------
|1 | @ObservationIgnored private var _webView: WKWebView?
| | `- error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
macro expansion @Observable:1:70: error: 'ObservationRegistrar' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:20:5: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
18 |
19 | public init() {}
20 | }
+--- macro expansion @Observable ------------------------------------
| 1 | @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
| | `- error: 'ObservationRegistrar' is only available in macOS 14.0 or newer
| 2 |
| 3 | internal nonisolated func access<Member>(
+--------------------------------------------------------------------
21 | }
22 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:20:6: error: 'Binding' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
18 | let markdown: String
19 |
20 | @Binding var height: CGFloat
| `- error: 'Binding' is only available in macOS 10.15 or newer
21 |
22 | @State var manager = Manager()
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:22:6: error: 'State' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
20 | @Binding var height: CGFloat
21 |
22 | @State var manager = Manager()
| `- error: 'State' is only available in macOS 10.15 or newer
23 |
24 | /// 建立 Markdown WebView
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:30:43: error: 'Binding' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
28 | /// - dynamicHeight: WebView 實際內容高度,透過 Coordinator 回寫給 SwiftUI
29 | /// - manager: WebView取值管理器
30 | public init(markdown: String, height: Binding<CGFloat>, manager: Manager = .init()) {
| | `- error: 'Binding' is only available in macOS 10.15 or newer
| `- note: add @available attribute to enclosing initializer
31 | self.markdown = markdown
32 | self.manager = manager
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:38:32: error: cannot find type 'UIViewRepresentable' in scope
36 |
37 | // MARK: - UIViewRepresentable
38 | extension WWMarkdownWebViewUI: UIViewRepresentable {}
| `- error: cannot find type 'UIViewRepresentable' in scope
39 | public extension WWMarkdownWebViewUI {
40 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:53:30: error: cannot find type 'Context' in scope
51 | /// - 設定 navigationDelegate
52 | /// - 載入初始 HTML template
53 | func makeUIView(context: Context) -> WKWebView {
| `- error: cannot find type 'Context' in scope
54 |
55 | let webView = makeWebView(coordinator: context.coordinator)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:66:54: error: cannot find type 'Context' in scope
64 | ///
65 | /// 這裡不重新建立 WebView,只更新顯示內容
66 | func updateUIView(_ webView: WKWebView, context: Context) {
| `- error: cannot find type 'Context' in scope
67 |
68 | context.coordinator.parent = self
[12/13] Compiling WWMarkdownWebViewUI WWMarkdownWebViewUI.swift
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
10 |
11 | // 管理 WebView 和 JS 結果的 ObservableObject
12 | public extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
16 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:20:6: error: 'Binding' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
18 | let markdown: String
19 |
20 | @Binding var height: CGFloat
| `- error: 'Binding' is only available in macOS 10.15 or newer
21 |
22 | @State var manager = Manager()
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:22:6: error: 'State' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
20 | @Binding var height: CGFloat
21 |
22 | @State var manager = Manager()
| `- error: 'State' is only available in macOS 10.15 or newer
23 |
24 | /// 建立 Markdown WebView
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:30:43: error: 'Binding' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
28 | /// - dynamicHeight: WebView 實際內容高度,透過 Coordinator 回寫給 SwiftUI
29 | /// - manager: WebView取值管理器
30 | public init(markdown: String, height: Binding<CGFloat>, manager: Manager = .init()) {
| | `- error: 'Binding' is only available in macOS 10.15 or newer
| `- note: add @available attribute to enclosing initializer
31 | self.markdown = markdown
32 | self.manager = manager
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:38:32: error: cannot find type 'UIViewRepresentable' in scope
36 |
37 | // MARK: - UIViewRepresentable
38 | extension WWMarkdownWebViewUI: UIViewRepresentable {}
| `- error: cannot find type 'UIViewRepresentable' in scope
39 | public extension WWMarkdownWebViewUI {
40 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:53:30: error: cannot find type 'Context' in scope
51 | /// - 設定 navigationDelegate
52 | /// - 載入初始 HTML template
53 | func makeUIView(context: Context) -> WKWebView {
| `- error: cannot find type 'Context' in scope
54 |
55 | let webView = makeWebView(coordinator: context.coordinator)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:66:54: error: cannot find type 'Context' in scope
64 | ///
65 | /// 這裡不重新建立 WebView,只更新顯示內容
66 | func updateUIView(_ webView: WKWebView, context: Context) {
| `- error: cannot find type 'Context' in scope
67 |
68 | context.coordinator.parent = self
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:32:9: error: setter for 'manager' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
28 | /// - dynamicHeight: WebView 實際內容高度,透過 Coordinator 回寫給 SwiftUI
29 | /// - manager: WebView取值管理器
30 | public init(markdown: String, height: Binding<CGFloat>, manager: Manager = .init()) {
| `- note: add @available attribute to enclosing initializer
31 | self.markdown = markdown
32 | self.manager = manager
| |- error: setter for 'manager' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
33 | _height = height
34 | }
macro expansion @Observable:1:2: error: 'ObservationTracked()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:9: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @Observable ------------------------------------
|1 | @ObservationTracked
| | `- error: 'ObservationTracked()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:111:23: error: 'defaultWebpagePreferences' is only available in macOS 10.15 or newer
90 |
91 | // MARK: - Private
92 | private extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
93 |
94 | /// 建立 WKWebView 並完成基礎設定
:
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add @available attribute to enclosing instance method
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
109 | let configuration = WKWebViewConfiguration()
110 | configuration.userContentController = contentController
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
| |- error: 'defaultWebpagePreferences' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
112 |
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:111:49: error: 'allowsContentJavaScript' is only available in macOS 11.0 or newer
90 |
91 | // MARK: - Private
92 | private extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
93 |
94 | /// 建立 WKWebView 並完成基礎設定
:
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add @available attribute to enclosing instance method
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
109 | let configuration = WKWebViewConfiguration()
110 | configuration.userContentController = contentController
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
| |- error: 'allowsContentJavaScript' is only available in macOS 11.0 or newer
| `- note: add 'if #available' version check
112 |
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:115:17: error: cannot assign to property: 'isOpaque' is a get-only property
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
114 | webView.navigationDelegate = coordinator
115 | webView.isOpaque = false
| `- error: cannot assign to property: 'isOpaque' is a get-only property
116 | webView.backgroundColor = .clear
117 | webView.scrollView.isScrollEnabled = false
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:116:17: error: value of type 'WKWebView' has no member 'backgroundColor'
114 | webView.navigationDelegate = coordinator
115 | webView.isOpaque = false
116 | webView.backgroundColor = .clear
| `- error: value of type 'WKWebView' has no member 'backgroundColor'
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:116:36: error: cannot infer contextual base in reference to member 'clear'
114 | webView.navigationDelegate = coordinator
115 | webView.isOpaque = false
116 | webView.backgroundColor = .clear
| `- error: cannot infer contextual base in reference to member 'clear'
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:117:17: error: value of type 'WKWebView' has no member 'scrollView'
115 | webView.isOpaque = false
116 | webView.backgroundColor = .clear
117 | webView.scrollView.isScrollEnabled = false
| `- error: value of type 'WKWebView' has no member 'scrollView'
118 | webView.scrollView.backgroundColor = .clear
119 | webView.loadHTMLString(htmlTemplate, baseURL: Bundle.module.resourceURL)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:118:17: error: value of type 'WKWebView' has no member 'scrollView'
116 | webView.backgroundColor = .clear
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
| `- error: value of type 'WKWebView' has no member 'scrollView'
119 | webView.loadHTMLString(htmlTemplate, baseURL: Bundle.module.resourceURL)
120 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:118:47: error: cannot infer contextual base in reference to member 'clear'
116 | webView.backgroundColor = .clear
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
| `- error: cannot infer contextual base in reference to member 'clear'
119 | webView.loadHTMLString(htmlTemplate, baseURL: Bundle.module.resourceURL)
120 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:105:33: warning: call to main actor-isolated initializer 'init()' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
105 | let contentController = WKUserContentController()
| `- warning: call to main actor-isolated initializer 'init()' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
106 | let weakHandler = WeakScriptMessageHandler(delegate: coordinator)
107 | contentController.add(weakHandler, name: Self.contentHeightName)
/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/usr/include/objc/NSObject.h:66:1: note: calls to initializer 'init()' from outside of its actor context are implicitly asynchronous
64 |
65 | + (void)initialize;
66 | - (instancetype)init
| `- note: calls to initializer 'init()' from outside of its actor context are implicitly asynchronous
67 | #if NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER
68 | NS_DESIGNATED_INITIALIZER
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:106:27: warning: call to main actor-isolated initializer 'init(delegate:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
105 | let contentController = WKUserContentController()
106 | let weakHandler = WeakScriptMessageHandler(delegate: coordinator)
| `- warning: call to main actor-isolated initializer 'init(delegate:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
107 | contentController.add(weakHandler, name: Self.contentHeightName)
108 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Handler.swift:26:5: note: calls to initializer 'init(delegate:)' from outside of its actor context are implicitly asynchronous
24 | /// 建立一個弱引用包裝器
25 | /// - Parameter delegate: 真正處理 JavaScript 訊息的對象 => 使用 weak 參考,避免形成強參考循環
26 | init(delegate: WKScriptMessageHandler) {
| |- note: calls to initializer 'init(delegate:)' from outside of its actor context are implicitly asynchronous
| `- note: main actor isolation inferred from conformance to protocol 'WKScriptMessageHandler'
27 | self.delegate = delegate
28 | }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:107:27: warning: call to main actor-isolated instance method 'add(_:name:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
105 | let contentController = WKUserContentController()
106 | let weakHandler = WeakScriptMessageHandler(delegate: coordinator)
107 | contentController.add(weakHandler, name: Self.contentHeightName)
| `- warning: call to main actor-isolated instance method 'add(_:name:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
108 |
109 | let configuration = WKWebViewConfiguration()
WebKit.WKUserContentController.add:2:22: note: calls to instance method 'add(_:name:)' from outside of its actor context are implicitly asynchronous
1 | class WKUserContentController {
2 | @MainActor open func add(_ scriptMessageHandler: any WKScriptMessageHandler, name: String)}
| `- note: calls to instance method 'add(_:name:)' from outside of its actor context are implicitly asynchronous
3 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:109:29: warning: call to main actor-isolated initializer 'init()' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
107 | contentController.add(weakHandler, name: Self.contentHeightName)
108 |
109 | let configuration = WKWebViewConfiguration()
| `- warning: call to main actor-isolated initializer 'init()' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
110 | configuration.userContentController = contentController
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/usr/include/objc/NSObject.h:66:1: note: calls to initializer 'init()' from outside of its actor context are implicitly asynchronous
64 |
65 | + (void)initialize;
66 | - (instancetype)init
| `- note: calls to initializer 'init()' from outside of its actor context are implicitly asynchronous
67 | #if NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER
68 | NS_DESIGNATED_INITIALIZER
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:110:23: warning: main actor-isolated property 'userContentController' can not be mutated from a nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
108 |
109 | let configuration = WKWebViewConfiguration()
110 | configuration.userContentController = contentController
| `- warning: main actor-isolated property 'userContentController' can not be mutated from a nonisolated context; this is an error in the Swift 6 language mode
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
112 |
/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h:118:56: note: mutation of this property is only permitted within the actor
116 | /*! @abstract The user content controller to associate with the web view.
117 | */
118 | @property (nonatomic, strong) WKUserContentController *userContentController;
| `- note: mutation of this property is only permitted within the actor
119 |
120 | /*! @abstract The web extension controller to associate with the web view.
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:111:49: warning: main actor-isolated property 'allowsContentJavaScript' can not be mutated from a nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
109 | let configuration = WKWebViewConfiguration()
110 | configuration.userContentController = contentController
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
| `- warning: main actor-isolated property 'allowsContentJavaScript' can not be mutated from a nonisolated context; this is an error in the Swift 6 language mode
112 |
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebpagePreferences.h:89:28: note: mutation of this property is only permitted within the actor
87 | The default value is YES.
88 | */
89 | @property (nonatomic) BOOL allowsContentJavaScript API_AVAILABLE(macos(11.0), ios(14.0));
| `- note: mutation of this property is only permitted within the actor
90 |
91 | /*! @abstract A boolean indicating whether lockdown mode is enabled.
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:111:23: warning: main actor-isolated property 'defaultWebpagePreferences' can not be referenced from a nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
109 | let configuration = WKWebViewConfiguration()
110 | configuration.userContentController = contentController
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
| `- warning: main actor-isolated property 'defaultWebpagePreferences' can not be referenced from a nonisolated context; this is an error in the Swift 6 language mode
112 |
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h:154:68: note: property declared here
152 | in -webView:decidePolicyForNavigationAction:preferences:decisionHandler:.
153 | */
154 | @property (null_resettable, nonatomic, copy) WKWebpagePreferences *defaultWebpagePreferences API_AVAILABLE(macos(10.15), ios(13.0));
| `- note: property declared here
155 |
156 | @property (nonatomic) BOOL limitsNavigationsToAppBoundDomains API_AVAILABLE(macos(11.0), ios(14.0));
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:113:23: warning: call to main actor-isolated initializer 'init(frame:configuration:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
112 |
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
| `- warning: call to main actor-isolated initializer 'init(frame:configuration:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
114 | webView.navigationDelegate = coordinator
115 | webView.isOpaque = false
/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebView.h:114:1: note: calls to initializer 'init(frame:configuration:)' from outside of its actor context are implicitly asynchronous
112 | on the web view.
113 | */
114 | - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration NS_DESIGNATED_INITIALIZER;
| `- note: calls to initializer 'init(frame:configuration:)' from outside of its actor context are implicitly asynchronous
115 |
116 | - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:114:17: warning: main actor-isolated property 'navigationDelegate' can not be mutated from a nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
112 |
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
114 | webView.navigationDelegate = coordinator
| `- warning: main actor-isolated property 'navigationDelegate' can not be mutated from a nonisolated context; this is an error in the Swift 6 language mode
115 | webView.isOpaque = false
116 | webView.backgroundColor = .clear
/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebView.h:94:65: note: mutation of this property is only permitted within the actor
92 |
93 | /*! @abstract The web view's navigation delegate. */
94 | @property (nullable, nonatomic, weak) id <WKNavigationDelegate> navigationDelegate;
| `- note: mutation of this property is only permitted within the actor
95 |
96 | /*! @abstract The web view's user interface delegate. */
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:119:17: warning: call to main actor-isolated instance method 'loadHTMLString(_:baseURL:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add '@MainActor' to make instance method 'makeWebView(coordinator:)' part of global actor 'MainActor'
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
119 | webView.loadHTMLString(htmlTemplate, baseURL: Bundle.module.resourceURL)
| `- warning: call to main actor-isolated instance method 'loadHTMLString(_:baseURL:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
120 |
121 | return webView
WebKit.WKWebView.loadHTMLString:2:22: note: calls to instance method 'loadHTMLString(_:baseURL:)' from outside of its actor context are implicitly asynchronous
1 | class WKWebView {
2 | @MainActor open func loadHTMLString(_ string: String, baseURL: URL?) -> WKNavigation?}
| `- note: calls to instance method 'loadHTMLString(_:baseURL:)' from outside of its actor context are implicitly asynchronous
3 |
[13/13] Compiling WWMarkdownWebViewUI Coordinator.swift
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:59:9: error: 'Task' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
58 |
59 | Task { @MainActor in
| |- error: 'Task' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
60 |
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:59:9: error: 'init(priority:operation:)' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
58 |
59 | Task { @MainActor in
| |- error: 'init(priority:operation:)' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
60 |
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:61:56: error: setter for 'height' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
:
59 | Task { @MainActor in
60 |
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
| |- error: setter for 'height' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
62 | if let height = message.body as? Double { self.parent.height = height; return }
63 | if let height = message.body as? Int { self.parent.height = CGFloat(height); return }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:62:55: error: setter for 'height' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
:
60 |
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
62 | if let height = message.body as? Double { self.parent.height = height; return }
| |- error: setter for 'height' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
63 | if let height = message.body as? Int { self.parent.height = CGFloat(height); return }
64 | }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:63:52: error: setter for 'height' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
:
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
62 | if let height = message.body as? Double { self.parent.height = height; return }
63 | if let height = message.body as? Int { self.parent.height = CGFloat(height); return }
| |- error: setter for 'height' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
64 | }
65 | }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:57:23: warning: main actor-isolated property 'name' can not be referenced from a nonisolated context; this is an error in the Swift 6 language mode
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add '@MainActor' to make instance method 'userContentController(_:didReceive:)' part of global actor 'MainActor'
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
| `- warning: main actor-isolated property 'name' can not be referenced from a nonisolated context; this is an error in the Swift 6 language mode
58 |
59 | Task { @MainActor in
/Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKScriptMessage.h:57:49: note: property declared here
55 | /*! @abstract The name of the message handler to which the message is sent.
56 | */
57 | @property (nonatomic, readonly, copy) NSString *name;
| `- note: property declared here
58 |
59 | /*! @abstract The content world from which the message was sent. */
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:99:17: warning: call to main actor-isolated instance method 'evaluateJavaScript(_:completionHandler:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
77 | ///
78 | /// 若 `force == true`,則即使內容未變動,也會強制重新渲染一次
79 | func renderIfNeeded(force: Bool = false) {
| `- note: add '@MainActor' to make instance method 'renderIfNeeded(force:)' part of global actor 'MainActor'
80 |
81 | guard isPageLoaded,
:
97 | """
98 |
99 | webView.evaluateJavaScript(js)
| `- warning: call to main actor-isolated instance method 'evaluateJavaScript(_:completionHandler:)' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
100 | lastRenderedMarkdown = markdown
101 | }
WebKit.WKWebView.evaluateJavaScript:2:22: note: calls to instance method 'evaluateJavaScript(_:completionHandler:)' from outside of its actor context are implicitly asynchronous
1 | class WKWebView {
2 | @MainActor open func evaluateJavaScript(_ javaScriptString: String, completionHandler: (@MainActor @Sendable (Any?, (any Error)?) -> Void)? = nil)}
| `- note: calls to instance method 'evaluateJavaScript(_:completionHandler:)' from outside of its actor context are implicitly asynchronous
3 |
Running build ...
env DEVELOPER_DIR=/Applications/Xcode-16.3.0.app xcrun swift build --arch arm64
[0/1] Planning build
Building for debugging...
[0/1] Write swift-version-2F0A5646E1D333AE.txt
[2/8] Compiling WWMarkdownWebViewUI resource_bundle_accessor.swift
[3/8] Compiling WWMarkdownWebViewUI WWMarkdownWebViewUI.swift
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
10 |
11 | // 管理 WebView 和 JS 結果的 ObservableObject
12 | public extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
16 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:20:6: error: 'Binding' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
18 | let markdown: String
19 |
20 | @Binding var height: CGFloat
| `- error: 'Binding' is only available in macOS 10.15 or newer
21 |
22 | @State var manager = Manager()
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:22:6: error: 'State' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
20 | @Binding var height: CGFloat
21 |
22 | @State var manager = Manager()
| `- error: 'State' is only available in macOS 10.15 or newer
23 |
24 | /// 建立 Markdown WebView
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:30:43: error: 'Binding' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
28 | /// - dynamicHeight: WebView 實際內容高度,透過 Coordinator 回寫給 SwiftUI
29 | /// - manager: WebView取值管理器
30 | public init(markdown: String, height: Binding<CGFloat>, manager: Manager = .init()) {
| | `- error: 'Binding' is only available in macOS 10.15 or newer
| `- note: add @available attribute to enclosing initializer
31 | self.markdown = markdown
32 | self.manager = manager
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:38:32: error: cannot find type 'UIViewRepresentable' in scope
36 |
37 | // MARK: - UIViewRepresentable
38 | extension WWMarkdownWebViewUI: UIViewRepresentable {}
| `- error: cannot find type 'UIViewRepresentable' in scope
39 | public extension WWMarkdownWebViewUI {
40 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:53:30: error: cannot find type 'Context' in scope
51 | /// - 設定 navigationDelegate
52 | /// - 載入初始 HTML template
53 | func makeUIView(context: Context) -> WKWebView {
| `- error: cannot find type 'Context' in scope
54 |
55 | let webView = makeWebView(coordinator: context.coordinator)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:66:54: error: cannot find type 'Context' in scope
64 | ///
65 | /// 這裡不重新建立 WebView,只更新顯示內容
66 | func updateUIView(_ webView: WKWebView, context: Context) {
| `- error: cannot find type 'Context' in scope
67 |
68 | context.coordinator.parent = self
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:32:9: error: setter for 'manager' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
28 | /// - dynamicHeight: WebView 實際內容高度,透過 Coordinator 回寫給 SwiftUI
29 | /// - manager: WebView取值管理器
30 | public init(markdown: String, height: Binding<CGFloat>, manager: Manager = .init()) {
| `- note: add @available attribute to enclosing initializer
31 | self.markdown = markdown
32 | self.manager = manager
| |- error: setter for 'manager' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
33 | _height = height
34 | }
macro expansion @Observable:1:2: error: 'ObservationTracked()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:9: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @Observable ------------------------------------
|1 | @ObservationTracked
| | `- error: 'ObservationTracked()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:111:23: error: 'defaultWebpagePreferences' is only available in macOS 10.15 or newer
90 |
91 | // MARK: - Private
92 | private extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
93 |
94 | /// 建立 WKWebView 並完成基礎設定
:
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add @available attribute to enclosing instance method
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
109 | let configuration = WKWebViewConfiguration()
110 | configuration.userContentController = contentController
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
| |- error: 'defaultWebpagePreferences' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
112 |
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:111:49: error: 'allowsContentJavaScript' is only available in macOS 11.0 or newer
90 |
91 | // MARK: - Private
92 | private extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
93 |
94 | /// 建立 WKWebView 並完成基礎設定
:
100 | /// - 關閉 WebView 自己的捲動,交由外層 SwiftUI 控制
101 | /// - 載入本地 HTML template
102 | func makeWebView(coordinator: Coordinator) -> WKWebView {
| `- note: add @available attribute to enclosing instance method
103 |
104 | let htmlTemplate = Self.readHtmlTemplate() ?? ""
:
109 | let configuration = WKWebViewConfiguration()
110 | configuration.userContentController = contentController
111 | configuration.defaultWebpagePreferences.allowsContentJavaScript = true
| |- error: 'allowsContentJavaScript' is only available in macOS 11.0 or newer
| `- note: add 'if #available' version check
112 |
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:115:17: error: cannot assign to property: 'isOpaque' is a get-only property
113 | let webView = WKWebView(frame: .zero, configuration: configuration)
114 | webView.navigationDelegate = coordinator
115 | webView.isOpaque = false
| `- error: cannot assign to property: 'isOpaque' is a get-only property
116 | webView.backgroundColor = .clear
117 | webView.scrollView.isScrollEnabled = false
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:116:17: error: value of type 'WKWebView' has no member 'backgroundColor'
114 | webView.navigationDelegate = coordinator
115 | webView.isOpaque = false
116 | webView.backgroundColor = .clear
| `- error: value of type 'WKWebView' has no member 'backgroundColor'
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:116:36: error: cannot infer contextual base in reference to member 'clear'
114 | webView.navigationDelegate = coordinator
115 | webView.isOpaque = false
116 | webView.backgroundColor = .clear
| `- error: cannot infer contextual base in reference to member 'clear'
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:117:17: error: value of type 'WKWebView' has no member 'scrollView'
115 | webView.isOpaque = false
116 | webView.backgroundColor = .clear
117 | webView.scrollView.isScrollEnabled = false
| `- error: value of type 'WKWebView' has no member 'scrollView'
118 | webView.scrollView.backgroundColor = .clear
119 | webView.loadHTMLString(htmlTemplate, baseURL: Bundle.module.resourceURL)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:118:17: error: value of type 'WKWebView' has no member 'scrollView'
116 | webView.backgroundColor = .clear
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
| `- error: value of type 'WKWebView' has no member 'scrollView'
119 | webView.loadHTMLString(htmlTemplate, baseURL: Bundle.module.resourceURL)
120 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:118:47: error: cannot infer contextual base in reference to member 'clear'
116 | webView.backgroundColor = .clear
117 | webView.scrollView.isScrollEnabled = false
118 | webView.scrollView.backgroundColor = .clear
| `- error: cannot infer contextual base in reference to member 'clear'
119 | webView.loadHTMLString(htmlTemplate, baseURL: Bundle.module.resourceURL)
120 |
[4/8] Compiling WWMarkdownWebViewUI Handler.swift
[5/8] Compiling WWMarkdownWebViewUI Manager.swift
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:32:22: warning: 'try' must precede 'await'
30 | guard let webView = webView else { return nil }
31 |
32 | let result = await try webView.evaluateJavaScript("getTextContent()")
| `- warning: 'try' must precede 'await'
33 | return result as? String
34 | }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:42:22: warning: 'try' must precede 'await'
40 | guard let webView = webView else { return nil }
41 |
42 | let result = await try webView.evaluateJavaScript("getHtmlContent()")
| `- warning: 'try' must precede 'await'
43 | return result as? String
44 | }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
10 |
11 | // 管理 WebView 和 JS 結果的 ObservableObject
12 | public extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
16 |
macro expansion @Observable:1:2: error: 'ObservationTracked()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:9: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @Observable ------------------------------------
|1 | @ObservationTracked
| | `- error: 'ObservationTracked()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
macro expansion @Observable:1:2: error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:20:5: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
18 |
19 | public init() {}
20 | }
+--- macro expansion @Observable ------------------------------------
| 1 | @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
| | `- error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
| 2 |
| 3 | internal nonisolated func access<Member>(
+--------------------------------------------------------------------
21 | }
22 |
macro expansion @ObservationTracked:1:2: error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:39: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @ObservationTracked ----------------------------
|1 | @ObservationIgnored private var _webView: WKWebView?
| | `- error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
macro expansion @Observable:1:70: error: 'ObservationRegistrar' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:20:5: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
18 |
19 | public init() {}
20 | }
+--- macro expansion @Observable ------------------------------------
| 1 | @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
| | `- error: 'ObservationRegistrar' is only available in macOS 14.0 or newer
| 2 |
| 3 | internal nonisolated func access<Member>(
+--------------------------------------------------------------------
21 | }
22 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
error: emit-module command failed with exit code 1 (use -v to see invocation)
[6/8] Compiling WWMarkdownWebViewUI Extension.swift
[7/8] Compiling WWMarkdownWebViewUI Coordinator.swift
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:59:9: error: 'Task' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
58 |
59 | Task { @MainActor in
| |- error: 'Task' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
60 |
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:59:9: error: 'init(priority:operation:)' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
58 |
59 | Task { @MainActor in
| |- error: 'init(priority:operation:)' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
60 |
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:61:56: error: setter for 'height' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
:
59 | Task { @MainActor in
60 |
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
| |- error: setter for 'height' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
62 | if let height = message.body as? Double { self.parent.height = height; return }
63 | if let height = message.body as? Int { self.parent.height = CGFloat(height); return }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:62:55: error: setter for 'height' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
:
60 |
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
62 | if let height = message.body as? Double { self.parent.height = height; return }
| |- error: setter for 'height' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
63 | if let height = message.body as? Int { self.parent.height = CGFloat(height); return }
64 | }
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Coordinator.swift:63:52: error: setter for 'height' is only available in macOS 10.15 or newer
46 |
47 | // MARK: - WKNavigationDelegate, WKScriptMessageHandler
48 | public extension WWMarkdownWebViewUI.Coordinator {
| `- note: add @available attribute to enclosing extension
49 |
50 | /// 接收 JavaScript 透過 `window.webkit.messageHandlers...postMessage(...)` 傳回的資料
:
53 | ///
54 | /// 由於 SwiftUI / UIKit 的畫面狀態更新應在主執行緒進行,這裡使用 `@MainActor` 切回主執行緒更新資料
55 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
| `- note: add @available attribute to enclosing instance method
56 |
57 | guard message.name == WWMarkdownWebViewUI.contentHeightName else { return }
:
61 | if let height = message.body as? CGFloat { self.parent.height = height; return }
62 | if let height = message.body as? Double { self.parent.height = height; return }
63 | if let height = message.body as? Int { self.parent.height = CGFloat(height); return }
| |- error: setter for 'height' is only available in macOS 10.15 or newer
| `- note: add 'if #available' version check
64 | }
65 | }
[8/8] Emitting module WWMarkdownWebViewUI
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
10 |
11 | // 管理 WebView 和 JS 結果的 ObservableObject
12 | public extension WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing extension
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
16 |
macro expansion @Observable:1:2: error: 'ObservationTracked()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:9: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @Observable ------------------------------------
|1 | @ObservationTracked
| | `- error: 'ObservationTracked()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
macro expansion @Observable:1:2: error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:20:5: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
18 |
19 | public init() {}
20 | }
+--- macro expansion @Observable ------------------------------------
| 1 | @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
| | `- error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
| 2 |
| 3 | internal nonisolated func access<Member>(
+--------------------------------------------------------------------
21 | }
22 |
macro expansion @ObservationTracked:1:2: error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:17:39: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
+--- macro expansion @ObservationTracked ----------------------------
|1 | @ObservationIgnored private var _webView: WKWebView?
| | `- error: 'ObservationIgnored()' is only available in macOS 14.0 or newer
+--------------------------------------------------------------------
18 |
19 | public init() {}
macro expansion @Observable:1:70: error: 'ObservationRegistrar' is only available in macOS 14.0 or newer
`- /Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:20:5: note: expanded code originates here
13 |
14 | @Observable
15 | final class Manager {
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
18 |
19 | public init() {}
20 | }
+--- macro expansion @Observable ------------------------------------
| 1 | @ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
| | `- error: 'ObservationRegistrar' is only available in macOS 14.0 or newer
| 2 |
| 3 | internal nonisolated func access<Member>(
+--------------------------------------------------------------------
21 | }
22 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/Utility/Manager.swift:14:6: error: 'Observable()' is only available in macOS 14.0 or newer
12 | public extension WWMarkdownWebViewUI {
13 |
14 | @Observable
| `- error: 'Observable()' is only available in macOS 14.0 or newer
15 | final class Manager {
| |- note: add @available attribute to enclosing class
| `- note: add @available attribute to enclosing class
16 |
17 | public var webView: WKWebView?
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:20:6: error: 'Binding' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
18 | let markdown: String
19 |
20 | @Binding var height: CGFloat
| `- error: 'Binding' is only available in macOS 10.15 or newer
21 |
22 | @State var manager = Manager()
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:22:6: error: 'State' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
20 | @Binding var height: CGFloat
21 |
22 | @State var manager = Manager()
| `- error: 'State' is only available in macOS 10.15 or newer
23 |
24 | /// 建立 Markdown WebView
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:30:43: error: 'Binding' is only available in macOS 10.15 or newer
12 | ///
13 | /// 內部透過本地 HTML template + JavaScript 將 Markdown 轉成 HTML,並把內容高度回傳給 SwiftUI,方便外部依照內容自動調整高度
14 | public struct WWMarkdownWebViewUI {
| `- note: add @available attribute to enclosing struct
15 |
16 | static let contentHeightName = "contentHeight" // JavaScript 回傳內容高度時使用的 message handler 名稱
:
28 | /// - dynamicHeight: WebView 實際內容高度,透過 Coordinator 回寫給 SwiftUI
29 | /// - manager: WebView取值管理器
30 | public init(markdown: String, height: Binding<CGFloat>, manager: Manager = .init()) {
| | `- error: 'Binding' is only available in macOS 10.15 or newer
| `- note: add @available attribute to enclosing initializer
31 | self.markdown = markdown
32 | self.manager = manager
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:38:32: error: cannot find type 'UIViewRepresentable' in scope
36 |
37 | // MARK: - UIViewRepresentable
38 | extension WWMarkdownWebViewUI: UIViewRepresentable {}
| `- error: cannot find type 'UIViewRepresentable' in scope
39 | public extension WWMarkdownWebViewUI {
40 |
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:53:30: error: cannot find type 'Context' in scope
51 | /// - 設定 navigationDelegate
52 | /// - 載入初始 HTML template
53 | func makeUIView(context: Context) -> WKWebView {
| `- error: cannot find type 'Context' in scope
54 |
55 | let webView = makeWebView(coordinator: context.coordinator)
/Users/admin/builder/spi-builder-workspace/Sources/WWMarkdownWebViewUI/WWMarkdownWebViewUI.swift:66:54: error: cannot find type 'Context' in scope
64 | ///
65 | /// 這裡不重新建立 WebView,只更新顯示內容
66 | func updateUIView(_ webView: WKWebView, context: Context) {
| `- error: cannot find type 'Context' in scope
67 |
68 | context.coordinator.parent = self
BUILD FAILURE 6.1 macosSpm