Skip to content

Commit

Permalink
fix: Fix Initializer bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercen-Lee committed Apr 1, 2024
1 parent 9133de7 commit 77d31d2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
20 changes: 16 additions & 4 deletions Source/DDS/Component/NavigationView/NavigationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ import SwiftUI
@available(macOS 12, iOS 15, *)
public struct DodamNavigationView<C: View>: NavigationViewProtocol {

internal let navigationBar: DodamNavigationBar
internal let buttons: [DodamNavigationBarButton]
internal let subView: AnyView?
internal let content: () -> C
public let navigationBar: DodamNavigationBar
public let buttons: [DodamNavigationBarButton]
public let subView: AnyView?
public let content: () -> C

public init(
navigationBar: DodamNavigationBar,
buttons: [DodamNavigationBarButton] = .init(),
subView: AnyView? = nil,
@ViewBuilder content: @escaping () -> C
) {
self.navigationBar = navigationBar
self.buttons = buttons
self.subView = subView
self.content = content
}

public var body: some View {
VStack(spacing: 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI

@available(macOS 12, iOS 15, *)
protocol NavigationViewProtocol: View {
public protocol NavigationViewProtocol: View {

associatedtype C: View

Expand All @@ -18,7 +18,7 @@ protocol NavigationViewProtocol: View {
)
}

extension NavigationViewProtocol {
public extension NavigationViewProtocol {

init(
navigationBar: DodamNavigationBar,
Expand Down
20 changes: 16 additions & 4 deletions Source/DDS/Component/ScrollView/ScrollView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ import SwiftUI
@available(macOS 12, iOS 15, *)
public struct DodamScrollView<C: View>: NavigationViewProtocol {

internal let navigationBar: DodamNavigationBar
internal let buttons: [DodamNavigationBarButton]
internal let subView: AnyView?
internal let content: () -> C
public let navigationBar: DodamNavigationBar
public let buttons: [DodamNavigationBarButton]
public let subView: AnyView?
public let content: () -> C

public init(
navigationBar: DodamNavigationBar,
buttons: [DodamNavigationBarButton] = .init(),
subView: AnyView? = nil,
@ViewBuilder content: @escaping () -> C
) {
self.navigationBar = navigationBar
self.buttons = buttons
self.subView = subView
self.content = content
}

public var body: some View {
ScrollView(showsIndicators: false) {
Expand Down

0 comments on commit 77d31d2

Please sign in to comment.