Skip to content

Commit

Permalink
add public init methods
Browse files Browse the repository at this point in the history
  • Loading branch information
devmehmetates committed Mar 2, 2024
1 parent 3d02bf7 commit 66e1fe8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Sources/ErrorableView/Abstract/ErrorableViewModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct ErrorableViewModifier<ErrorContent: ErrorableView>: ViewModifier {
@Binding var pageState: PageStates
var errorContent: ErrorContent

init(pageState: Binding<PageStates>,
public init(pageState: Binding<PageStates>,
@ViewBuilder errorContent: () -> ErrorContent) {
self._pageState = pageState
self.errorContent = errorContent()
Expand Down
14 changes: 11 additions & 3 deletions Sources/ErrorableView/Views/DefaultErrorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ public protocol ErrorableView: View {
}

@frozen public struct DefaultErrorView: ErrorableView {
var uimodel: DefaultErrorPageUIModel = .Builder().build()
public var type: ErrorPresentTypes = .sheet
var buttonAction: (() -> Void)? = nil
var uimodel: DefaultErrorPageUIModel
public var type: ErrorPresentTypes
var buttonAction: (() -> Void)?

public init(uimodel: DefaultErrorPageUIModel = .Builder().build(),
type: ErrorPresentTypes = .sheet,
buttonAction: (() -> Void)? = nil) {
self.uimodel = uimodel
self.type = type
self.buttonAction = buttonAction
}

public var body: some View {
VStack {
Expand Down
9 changes: 8 additions & 1 deletion Sources/ErrorableView/Views/DefaultLoadingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ import SwiftUI

@frozen public struct DefaultLoadingView: View {
var loadingText: LocalizedStringKey
var progressViewColor: Color = .accentColor
var progressViewColor: Color

public init(loadingText: LocalizedStringKey,
progressViewColor: Color = .accentColor
) {
self.loadingText = loadingText
self.progressViewColor = progressViewColor
}

public var body: some View {
VStack {
Expand Down

0 comments on commit 66e1fe8

Please sign in to comment.