Skip to content

Commit 8f0999a

Browse files
committed
Remove unnecessary argument (useUINavigationController)
1 parent 857dbf3 commit 8f0999a

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

Sources/LicenseList/LicenseListView.swift

+3-14
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,19 @@ public struct LicenseListView: View {
1111
@Environment(\.licenseListViewStyle) private var licenseListViewStyle: LicenseListViewStyle
1212

1313
let libraries = Library.libraries
14-
let useUINavigationController: Bool
1514
let navigationHandler: ((Library) -> Void)?
1615

17-
public init(
18-
useUINavigationController: Bool = false,
19-
navigationHandler: ((Library) -> Void)? = nil
20-
) {
21-
self.useUINavigationController = useUINavigationController
16+
public init(navigationHandler: ((Library) -> Void)? = nil) {
2217
self.navigationHandler = navigationHandler
2318
}
2419

2520
public var body: some View {
2621
List {
2722
ForEach(libraries) { library in
28-
if useUINavigationController {
23+
if let navigationHandler {
2924
HStack {
3025
Button {
31-
navigationHandler?(library)
26+
navigationHandler(library)
3227
} label: {
3328
Text(library.name)
3429
}
@@ -65,9 +60,3 @@ public struct LicenseListView: View {
6560
}
6661
}
6762
}
68-
69-
public extension LicenseListView {
70-
init(useUINavigationController: Bool = false) {
71-
self.init(useUINavigationController: useUINavigationController, navigationHandler: { _ in })
72-
}
73-
}

Sources/LicenseList/LicenseListViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class LicenseListViewController: UIViewController {
2121

2222
public override func viewDidLoad() {
2323
super.viewDidLoad()
24-
let licenseListView = LicenseListView(useUINavigationController: true) { [weak self] library in
24+
let licenseListView = LicenseListView() { [weak self] library in
2525
self?.navigateTo(library: library)
2626
}
2727
let vc = UIHostingController(rootView: licenseListView)

0 commit comments

Comments
 (0)