Tab Bar: Adds tab bar view/view controller

This commit is contained in:
James Magahern
2020-10-28 17:57:34 -07:00
parent af296d7430
commit 5e9c6e5880
7 changed files with 390 additions and 7 deletions

View File

@@ -9,7 +9,9 @@ import Foundation
class TabController
{
var tabs: [Tab] = []
@Published var tabs: [Tab] = []
@Published var activeTabIndex: Int = 0
var policyManager = ResourcePolicyManager()
init() {
@@ -39,6 +41,13 @@ class TabController
func closeTab(_ tab: Tab) {
if let index = tabs.firstIndex(of: tab) {
tabs.remove(at: index)
if tabs.count > 0 {
activeTabIndex = tabs.count - 1
} else {
_ = createNewTab(url: nil)
activeTabIndex = 0
}
}
}
}