diff --git a/Sources/LicenseList/LicenseListView.swift b/Sources/LicenseList/LicenseListView.swift index 8cf48ab..1998fc7 100644 --- a/Sources/LicenseList/LicenseListView.swift +++ b/Sources/LicenseList/LicenseListView.swift @@ -11,24 +11,19 @@ public struct LicenseListView: View { @Environment(\.licenseListViewStyle) private var licenseListViewStyle: LicenseListViewStyle let libraries = Library.libraries - let useUINavigationController: Bool let navigationHandler: ((Library) -> Void)? - public init( - useUINavigationController: Bool = false, - navigationHandler: ((Library) -> Void)? = nil - ) { - self.useUINavigationController = useUINavigationController + public init(navigationHandler: ((Library) -> Void)? = nil) { self.navigationHandler = navigationHandler } public var body: some View { List { ForEach(libraries) { library in - if useUINavigationController { + if let navigationHandler { HStack { Button { - navigationHandler?(library) + navigationHandler(library) } label: { Text(library.name) } @@ -65,9 +60,3 @@ public struct LicenseListView: View { } } } - -public extension LicenseListView { - init(useUINavigationController: Bool = false) { - self.init(useUINavigationController: useUINavigationController, navigationHandler: { _ in }) - } -} diff --git a/Sources/LicenseList/LicenseListViewController.swift b/Sources/LicenseList/LicenseListViewController.swift index c4a230d..00494a2 100644 --- a/Sources/LicenseList/LicenseListViewController.swift +++ b/Sources/LicenseList/LicenseListViewController.swift @@ -21,7 +21,7 @@ public class LicenseListViewController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() - let licenseListView = LicenseListView(useUINavigationController: true) { [weak self] library in + let licenseListView = LicenseListView() { [weak self] library in self?.navigateTo(library: library) } let vc = UIHostingController(rootView: licenseListView)