Skip to content

Commit

Permalink
Add convenience initializier
Browse files Browse the repository at this point in the history
  • Loading branch information
nityanandaz committed Mar 13, 2024
1 parent 518eac4 commit b14285e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ public struct NavigationDestinationThreadViewModifier: ViewModifier {
public init() {}

public func body(content: Content) -> some View {
content.navigationDestination(for: MessagePath.self) { messagePath in
MessageDetailView(viewModel: messagePath.conversationViewModel, message: messagePath.message)
}
content.navigationDestination(for: MessagePath.self, destination: MessageDetailView.init)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ struct MessageDetailView: View {
}
}

extension MessageDetailView {
init(path: MessagePath) {
self.init(viewModel: path.conversationViewModel, message: path.message)
}
}

private extension MessageDetailView {
func top(message: BaseMessage) -> some View {
MessageCell(
Expand Down

0 comments on commit b14285e

Please sign in to comment.