Tab Bar: Adds tab bar view/view controller
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user