I'm currently testing SwiftUI's WebKit
by building a browsing application.
For the back navigation, I have the following code implemented:
if let item = webPage.backForwardList.backList.last {
webPage.load(item)
print(
"""
=====
backForwardList.backList:
\(webPage.backForwardList.backList)
---
backForwardList.currentItem:
\(webPage.backForwardList.currentItem)
---
backForwardList.forwardList:
\(webPage.backForwardList.forwardList)
=====
""".trimmingCharacters(in: .whitespacesAndNewlines)
)
}
When I look at the logs, it shows that whenever I navigate back, the currentItem
is updated with the item
, but the backList
is appended with the previous currentItem
, and the forwardList
is always empty.
Am I implementing this incorrectly?
Thanks in advance!