API to allow tabs to be created with URL
This commit is contained in:
@@ -14,7 +14,7 @@ class TabController
|
||||
|
||||
init() {
|
||||
// TODO: load tabs from disk.
|
||||
_ = createNewTab()
|
||||
_ = createNewTab(url: nil)
|
||||
}
|
||||
|
||||
func tab(forURL url: URL) -> Tab? {
|
||||
@@ -25,8 +25,8 @@ class TabController
|
||||
tabs.first { $0.identifier == identifier }
|
||||
}
|
||||
|
||||
func createNewTab() -> Tab {
|
||||
let tab = Tab(policyManager: policyManager)
|
||||
func createNewTab(url: URL?) -> Tab {
|
||||
let tab = Tab(url: url, policyManager: policyManager)
|
||||
tabs.append(tab)
|
||||
|
||||
return tab
|
||||
|
||||
@@ -115,7 +115,7 @@ class TabPickerViewController: UIViewController, UICollectionViewDelegate
|
||||
self.view = self.collectionView
|
||||
|
||||
let newTabButton = UIBarButtonItem(systemItem: .add, primaryAction: UIAction(handler: { [unowned self] _ in
|
||||
let newTab = self.tabController.createNewTab()
|
||||
let newTab = self.tabController.createNewTab(url: nil)
|
||||
self.delegate?.tabPicker(self, didSelectTab: newTab)
|
||||
}), menu: nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user