Skip to content

Commit

Permalink
Update package
Browse files Browse the repository at this point in the history
  • Loading branch information
vmanot committed Jul 27, 2024
1 parent 6bc1e5e commit 1912778
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ let package = Package(
name: "ChatKit",
dependencies: [
"CorePersistence",
.product(name: "MarkdownUI", package: "SwiftUIZ"),
"Swallow",
"SwiftUIX",
"SwiftUIZ",
Expand Down
29 changes: 13 additions & 16 deletions Sources/Intramodular/ChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,27 @@ public struct ChatView<Content: View>: View {
let content: Content
let inputView: AnyView?

@State public var _chatViewPreferences = _ChatViewPreferences()

public var body: some View {
_SwiftUI_UnaryViewAdaptor {
XStack(alignment: .top) {
content
_PreferenceReader(_ChatViewPreferences._PreferenceKey.self) { _chatViewPreferences in
_SwiftUI_UnaryViewAdaptor {
XStack(alignment: .top) {
content
}
}
}
.modify(forUnwrapped: inputView) { inputView in
AnyViewModifier {
$0._bottomBar {
inputView
.padding(.horizontal)
.environment(\._chatViewPreferences, merging: _chatViewPreferences)
.modify(forUnwrapped: inputView) { inputView in
AnyViewModifier {
$0._bottomBar {
inputView
.padding(.horizontal)
}
}
}
}
.environment(\._chatViewPreferences, merging: _chatViewPreferences)
.onPreferenceChange(_ChatViewPreferences._PreferenceKey.self) {
self._chatViewPreferences = $0
}
}
}

extension View {
extension View {
public func onChatInterrupt(
perform action: @escaping () -> Void
) -> some View {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Intramodular/Core/_ChatItemConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Copyright (c) Vatsal Manot
//


import Foundation
import SwiftUIZ

struct _ChatItemConfiguration: Initiable, ExpressibleByNilLiteral {
var onEdit: ((AnyChatItemContent) -> Void)?
Expand Down
1 change: 1 addition & 0 deletions Sources/Intramodular/Message List/_ChatMessageListB.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public struct _ChatMessageListB<Content: View>: View {
.modifier(_ChatMessageListB_ScrollBehavior(scrollView: scrollView, lastItem: $lastItem))
}
}
._SwiftUIX_defaultScrollAnchor(.bottom)
}
}

Expand Down
1 change: 0 additions & 1 deletion Sources/module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
//

@_exported import SwiftUIX
@_exported import SwiftUIZ

0 comments on commit 1912778

Please sign in to comment.