File tree 2 files changed +4
-15
lines changed
2 files changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -11,24 +11,19 @@ public struct LicenseListView: View {
11
11
@Environment ( \. licenseListViewStyle) private var licenseListViewStyle : LicenseListViewStyle
12
12
13
13
let libraries = Library . libraries
14
- let useUINavigationController : Bool
15
14
let navigationHandler : ( ( Library ) -> Void ) ?
16
15
17
- public init (
18
- useUINavigationController: Bool = false ,
19
- navigationHandler: ( ( Library ) -> Void ) ? = nil
20
- ) {
21
- self . useUINavigationController = useUINavigationController
16
+ public init ( navigationHandler: ( ( Library ) -> Void ) ? = nil ) {
22
17
self . navigationHandler = navigationHandler
23
18
}
24
19
25
20
public var body : some View {
26
21
List {
27
22
ForEach ( libraries) { library in
28
- if useUINavigationController {
23
+ if let navigationHandler {
29
24
HStack {
30
25
Button {
31
- navigationHandler ? ( library)
26
+ navigationHandler ( library)
32
27
} label: {
33
28
Text ( library. name)
34
29
}
@@ -65,9 +60,3 @@ public struct LicenseListView: View {
65
60
}
66
61
}
67
62
}
68
-
69
- public extension LicenseListView {
70
- init ( useUINavigationController: Bool = false ) {
71
- self . init ( useUINavigationController: useUINavigationController, navigationHandler: { _ in } )
72
- }
73
- }
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public class LicenseListViewController: UIViewController {
21
21
22
22
public override func viewDidLoad( ) {
23
23
super. viewDidLoad ( )
24
- let licenseListView = LicenseListView ( useUINavigationController : true ) { [ weak self] library in
24
+ let licenseListView = LicenseListView ( ) { [ weak self] library in
25
25
self ? . navigateTo ( library: library)
26
26
}
27
27
let vc = UIHostingController ( rootView: licenseListView)
You can’t perform that action at this time.
0 commit comments