added tvcontroller
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
fa591d18fe
commit
ef961270ab
@ -36,6 +36,7 @@
|
|||||||
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD829CE1CF900E62B51 /* LineViewController.swift */; };
|
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD829CE1CF900E62B51 /* LineViewController.swift */; };
|
||||||
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
|
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
|
||||||
EA0FC2C12912DC5500DF80B4 /* TextLinkCaretViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */; };
|
EA0FC2C12912DC5500DF80B4 /* TextLinkCaretViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */; };
|
||||||
|
EA297A682A02F5320031ED56 /* TableViewTestController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA297A672A02F5320031ED56 /* TableViewTestController.swift */; };
|
||||||
EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9C289966EF000CA526 /* AppDelegate.swift */; };
|
EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9C289966EF000CA526 /* AppDelegate.swift */; };
|
||||||
EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */; };
|
EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */; };
|
||||||
EA3C3BA4289966EF000CA526 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA3C3BA2289966EF000CA526 /* Main.storyboard */; };
|
EA3C3BA4289966EF000CA526 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA3C3BA2289966EF000CA526 /* Main.storyboard */; };
|
||||||
@ -121,6 +122,7 @@
|
|||||||
44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = "<group>"; };
|
44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = "<group>"; };
|
||||||
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
|
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
|
||||||
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLinkCaretViewController.swift; sourceTree = "<group>"; };
|
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLinkCaretViewController.swift; sourceTree = "<group>"; };
|
||||||
|
EA297A672A02F5320031ED56 /* TableViewTestController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewTestController.swift; sourceTree = "<group>"; };
|
||||||
EA3C3B99289966EF000CA526 /* VDSSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VDSSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
EA3C3B99289966EF000CA526 /* VDSSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VDSSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
EA3C3B9C289966EF000CA526 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
EA3C3B9C289966EF000CA526 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
||||||
@ -309,6 +311,7 @@
|
|||||||
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
||||||
EAB2375F29E88D5D00AABE9A /* TooltipViewController.swift */,
|
EAB2375F29E88D5D00AABE9A /* TooltipViewController.swift */,
|
||||||
EAB2376B29E9E74900AABE9A /* TrailingTooltipLabel.swift */,
|
EAB2376B29E9E74900AABE9A /* TrailingTooltipLabel.swift */,
|
||||||
|
EA297A672A02F5320031ED56 /* TableViewTestController.swift */,
|
||||||
);
|
);
|
||||||
path = ViewControllers;
|
path = ViewControllers;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -459,6 +462,7 @@
|
|||||||
EAB5FEEF2927E28400998C17 /* ButtonGroupViewController.swift in Sources */,
|
EAB5FEEF2927E28400998C17 /* ButtonGroupViewController.swift in Sources */,
|
||||||
EA89204C28B66CE2006B9984 /* ScrollWrapperView.swift in Sources */,
|
EA89204C28B66CE2006B9984 /* ScrollWrapperView.swift in Sources */,
|
||||||
EA89205128B68307006B9984 /* TextField.swift in Sources */,
|
EA89205128B68307006B9984 /* TextField.swift in Sources */,
|
||||||
|
EA297A682A02F5320031ED56 /* TableViewTestController.swift in Sources */,
|
||||||
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */,
|
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */,
|
||||||
EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */,
|
EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */,
|
||||||
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */,
|
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */,
|
||||||
@ -647,7 +651,7 @@
|
|||||||
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@ -677,7 +681,7 @@
|
|||||||
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
|||||||
@ -71,6 +71,7 @@ class MenuViewController: UITableViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let items: [MenuComponent] = [
|
let items: [MenuComponent] = [
|
||||||
|
MenuComponent(title: "Tester", completed: true, viewController: TableViewTestController.self),
|
||||||
MenuComponent(title: "Badge", completed: true, viewController: BadgeViewController.self),
|
MenuComponent(title: "Badge", completed: true, viewController: BadgeViewController.self),
|
||||||
MenuComponent(title: "Button", completed: true, viewController: ButtonViewController.self),
|
MenuComponent(title: "Button", completed: true, viewController: ButtonViewController.self),
|
||||||
MenuComponent(title: "ButtonGroup", completed: true, viewController: ButtonGroupViewController.self),
|
MenuComponent(title: "ButtonGroup", completed: true, viewController: ButtonGroupViewController.self),
|
||||||
|
|||||||
119
VDSSample/ViewControllers/TableViewTestController.swift
Normal file
119
VDSSample/ViewControllers/TableViewTestController.swift
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
//
|
||||||
|
// TableViewTestController.swift
|
||||||
|
// VDSSample
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 5/3/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
import VDS
|
||||||
|
|
||||||
|
protocol Componentable {
|
||||||
|
func getCompontent() -> UIView
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BaseViewController: Componentable {
|
||||||
|
func getCompontent() -> UIView { contentTopView.removeFromSuperview(); return contentTopView }
|
||||||
|
}
|
||||||
|
|
||||||
|
//public class TableViewTestController: UIViewController, Initable {
|
||||||
|
// let component = TrailingTooltipLabel()
|
||||||
|
//
|
||||||
|
// public override func viewDidLoad() {
|
||||||
|
// super.viewDidLoad()
|
||||||
|
//
|
||||||
|
// component.layer.borderColor = UIColor.red.cgColor
|
||||||
|
// component.label.layer.borderWidth = 1
|
||||||
|
// component.labelText = "Label Component"
|
||||||
|
// component.labelTextStyle = .titleLarge
|
||||||
|
// component.tooltipTitle = "5G Ultra Wideband is available in your area."
|
||||||
|
// component.tooltipContent = "$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in/promo credit applied over 36 mos.; promo credit ends if eligibility req’s are no longer met; 0% APR. Trade-in conditions apply.$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in."
|
||||||
|
//
|
||||||
|
// view.addSubview(component)
|
||||||
|
// view.backgroundColor = .white
|
||||||
|
// NSLayoutConstraint.activate([
|
||||||
|
// component.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16),
|
||||||
|
// component.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 16),
|
||||||
|
// component.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor)
|
||||||
|
// ])
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public override func viewDidAppear(_ animated: Bool) {
|
||||||
|
// super.viewDidAppear(animated)
|
||||||
|
//
|
||||||
|
// DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||||
|
// self.component.tooltipTitle = "q234"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
public class TableViewTestController: UITableViewController, Initable {
|
||||||
|
|
||||||
|
var controllers:[UIViewController] = []
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//--------------------------------------------------
|
||||||
|
required public init() {
|
||||||
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
public override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
let menus = MenuViewController()
|
||||||
|
controllers = menus.items.compactMap({ menuItem in
|
||||||
|
guard let vc = menuItem.viewController as? Initable.Type,
|
||||||
|
let controller = vc.init() as? UIViewController,
|
||||||
|
menuItem.viewController != Self.self else { return nil }
|
||||||
|
|
||||||
|
controller.title = menuItem.title
|
||||||
|
controller.viewDidLoad()
|
||||||
|
return controller
|
||||||
|
})
|
||||||
|
tableView.register(VDSCell.self, forCellReuseIdentifier: "cell")
|
||||||
|
tableView.allowsSelection = false
|
||||||
|
tableView.estimatedRowHeight = 100
|
||||||
|
tableView.rowHeight = UITableView.automaticDimension
|
||||||
|
tableView.reloadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
public override func numberOfSections(in tableView: UITableView) -> Int {
|
||||||
|
1 //controllers.count
|
||||||
|
}
|
||||||
|
|
||||||
|
public override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||||
|
let vc = controllers[section]
|
||||||
|
return vc.title
|
||||||
|
}
|
||||||
|
|
||||||
|
public override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
|
guard let vc = controllers[indexPath.section] as? Componentable, let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as? VDSCell else { return UITableViewCell() }
|
||||||
|
//let component = vc.getCompontent()
|
||||||
|
let component = TrailingTooltipLabel()
|
||||||
|
component.labelText = "Label Component"
|
||||||
|
component.labelTextStyle = .bodyLarge
|
||||||
|
component.tooltipTitle = "5G Ultra Wideband is available in your area."
|
||||||
|
component.tooltipContent = "$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in/promo credit applied over 36 mos.; promo credit ends if eligibility req’s are no longer met; 0% APR. Trade-in conditions apply.$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in."
|
||||||
|
|
||||||
|
cell.subviews.forEach { $0.removeFromSuperview() }
|
||||||
|
cell.addSubview(component)
|
||||||
|
component.pinToSuperView()
|
||||||
|
return cell
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VDSCell: UITableViewCell, AppleGuidlinesTouchable {
|
||||||
|
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||||
|
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user