-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Example + add bottom sheet to 2.0.0 #23
base: release/2.0.0
Are you sure you want to change the base?
Fix Example + add bottom sheet to 2.0.0 #23
Conversation
Sources/Navidux/Core/Navigation/NavigationAction/Actions/PushNavigationAction.swift
Outdated
Show resolved
Hide resolved
Sources/Navidux/Core/Navigation/NavigationAction/Actions/PushNavigationAction.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Глянул свежим взглядом, появилось еще пару предложений
public struct NavigationStore { | ||
public var isAlertShow: Bool = false | ||
public var hasOverlay: Bool = false | ||
|
||
public init(isAlertShow: Bool = false, hasOverlay: Bool = false) { | ||
self.isAlertShow = isAlertShow | ||
self.hasOverlay = hasOverlay | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я думаю будет хорошей идеей подписать Store
под ObservableObject
, чтобы юзеры могли подписываться под обновления. Быстренько набросал то как я вижу эти изменения:
public struct NavigationStore { | |
public var isAlertShow: Bool = false | |
public var hasOverlay: Bool = false | |
public init(isAlertShow: Bool = false, hasOverlay: Bool = false) { | |
self.isAlertShow = isAlertShow | |
self.hasOverlay = hasOverlay | |
} | |
} | |
public final class NavigationStore: ObservableObject { | |
@Published public var isAlertPresented: Bool = false | |
@Published public var isModalPresented: Bool = false | |
} |
class BSBuilder { | ||
|
||
static func buildBottomSheet( | ||
coordinator: Coordinator, | ||
screen: any NavigationScreen, | ||
size: BSSize | ||
) { | ||
switch size { | ||
case .auto: | ||
coordinator.bottomSheetTransitioningDelegate.sheetSize = .auto | ||
screen.transitioningDelegate = coordinator.bottomSheetTransitioningDelegate | ||
screen.modalPresentationStyle = .custom | ||
case .fixed(let height): | ||
coordinator.bottomSheetTransitioningDelegate.sheetSize = .fixed(height) | ||
screen.transitioningDelegate = coordinator.bottomSheetTransitioningDelegate | ||
screen.modalPresentationStyle = .custom | ||
case .halfScreen: | ||
coordinator.bottomSheetTransitioningDelegate.sheetSize = .halfScreen | ||
screen.transitioningDelegate = coordinator.bottomSheetTransitioningDelegate | ||
screen.modalPresentationStyle = .custom | ||
case .fullScreen: | ||
screen.modalPresentationStyle = .formSheet | ||
} | ||
coordinator.store.hasOverlay = true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может тогда лучше будем хранить делегат тут, чтобы не прокидывать координатор сюда, а то как-то слишком неочевидно получается. Давай еще переименуем функцию просто в build(screen:size:)
, а то c окончанием bottomSheet
будто получается тавтология. Плюсом сюда думаю будет правильней возвращать уже сконфигурированный экран, чтобы не нарушать семантику, т.к. мы используем слово build
No description provided.