Releases: x-0o0/ChatUI
1.0.0-beta.9
What's Changed
- Updated to allow configuration of Giphy UI by @fred-bowker in #31
- [FIX] Adjusted code styles by @jaesung-0o0 in #32
- Added
NextMessageField
to provide easy-customizable contents by @jaesung-0o0 in #33 - Added
scrolledToEndPublisher
(Beta) by @jaesung-0o0 in #34
New Contributors
- @fred-bowker made their first contribution in #31
Full Changelog: 1.0.0-beta.8...1.0.0-beta.9
Example Usage - NextMessageField
@State private var text: String = ""
NextMessageField(text) { messageStyle in
guard !text.isEmpty else { return }
viewModel.sendMessage($0)
text = ""
} leftLabel: {
HStack {
Button(aciton: showCamera) {
Image.camera.medium
}
.frame(width: 36, height: 36)
Button(action: showLibrary) {
Image.photoLibrary.medium
}
.frame(width: 36, height: 36)
} rightLabel: {
Button {
// send message by using `sendMessagePublisher`. This will invoke `onSend` handler.
sendMessagePublisher.send(.text(text))
} label: {
// send button icon
Image.send.medium
}
.frame(width: 36, height: 36)
}
Example Usage - GiphyConfiguration
let giphyConfig = GiphyConfiguration(
dimBackground: true,
presentationDetents = 0.7
)
let chatConfig = ChatConfiguration(
userID: "{USER.ID}",
giphyKey: "{YOUR.GIPHY.KEY}",
giphyConfig: giphyConfig
)
// ...
ChatView()
.environmentObject(chatConfig)
Notice
scrolledToEndPublisher
publisher is added, but because it's a beta feature, I'm not responsible for any issues that may arise during using it.- Added
messageTimeFormat
toAppearance
. This allows to display 24 hour clock - Removed the padding of the
MessageField
to prevent making too much top spacing. To adjust a padding to theMessageField
, please use.padding()
modifier manually.
1.0.0-beta.8
What's Changed
- [FIX] Fixed issue that the list isn't scrolled when tap message row by @jaesung-0o0 in #28
Full Changelog: 1.0.0-beta.7...1.0.0-beta.8
1.0.0-beta.7
What's Changed
- Renamed
Appearance/messagebody
toAppearance/body
by @jaesung-0o0 in #24 - [ADD] Added
public init
to message views by @jaesung-0o0 in #23 - [FIX] Allowed nullable
MessageList/menuContent
by @jaesung-0o0 in #22 - [ADD] Added menu content condition to handle
highlightMessagePublisher
by @jaesung-0o0 in https://github.com/jaesung-
Full Changelog: 1.0.0-beta.6...1.0.0-beta.7
1.0.0-beta.6
What's Changed
- [ADD] Added
MessageRow/lineLimit
andMessageField/characterLimit
by @jaesung-0o0 in #21
Full Changelog: 1.0.0-beta.5...1.0.0-beta.6
Supports line limit in MessageRow
and character limit in MessageField
. Now both have an unlimited line(or character) as a default.
Here is an example usage:
MessageList(messages) { message
// rowContent
MessageRow(message: message, lineLimit: 10) // 🌟 set `lineLimit`. The default is `nil` which means unlimited
.padding(.top, 12)
}
MessageField(characterLimit: 300) { messageStyle in // 🌟 set `characterLimit`. The default is `nil` which means unlimited
// send message...
}
Additional Information
💡 It is not necessary to use MessageRow
in the rowContent
of MessageList
. It's able to design your own message row that suits your app's needs by using the messageStyle(_:)
modifier in View
that is provided by ChatUI.
- Example usage:
MessageList(messages) { message in
HStack(alignment: .top, spacing: 8) {
AsyncImage(url: message.sender.imageURL) { image in
image
.resizable()
.messageStyle(.senderProfile)
} placeholder: {
Image(systemName: "person.crop.circle.fill")
.resizable()
.messageStyle(.senderProfile)
.foregroundColor(appearance.secondary)
}
VStack(alignment: .leading, spacing: 8) {
switch style {
case .text(let text):
let markdown = LocalizedStringKey(text)
Text(markdown)
.fixedSize(horizontal: false, vertical: true) // or use `.lineLimit(nil`
.tint(isMyMessage ? appearance.prominentLink : appearance.link)
.messageStyle(isMyMessage ? .localBody({LINE.LIMIT}) : .remoteBody({LINE.LIMIT}))
default:
Text("Not supported format")
}
Text(Date(timeIntervalSince1970: message.sentAt), formatter: formatter)
.messageStyle(.date)
}
}
}
1.0.0-beta.5
What's Changed
- [Release/1.0.0-beta.5] Fixed
highlightMessagePublisher
to sendnil
when tap blur background view by @jaesung-0o0 in #17
Full Changelog: 1.0.0-beta.4...1.0.0-beta.5
Implementation Guide
MessageList(message)
.onReceive(highlightMessagePublisher) { highlightMessage in
withAnimation {
self.highlightMessage = highlightMessage as? Message
}
}
if highlightMessage == nil {
MessageField { messageStyle in
print(messageStyle)
}
}
1.0.0-beta.4
What's Changed
- Bug-fix on
MessageDateView/date
by @jaesung-0o0 in #14
Full Changelog: 1.0.0-beta.3...1.0.0-beta.4
1.0.0-beta.3
What's Changed
- Added
MessageDateView
by @jaesung-0o0 in #12 - Modified
highlightMessagePublisher
to send optional value by @jaesung-0o0 in #13
Full Changelog: 1.0.0-beta.2...1.0.0-beta.3
1.0.0-beta.2
What's Changed
- [Release/1.0.0-beta.2] Message Menu by @jaesung-0o0 in #10
Full Changelog: 1.0.0-beta.1...1.0.0-beta.2
How to show message menu on long press gesture
You can add message menus to display when a rowContent
(such as MessageRow
) is on long press gesture by setting menuContent
parameter of the MessageList
initializer.
MessageMenu
and MessageMenubuttonStyle
allow you to create message menu more easily. Here is an example:
MessageList(messages) { message in
// row content
MessageRow(message: message)
.padding(.top, 12)
} menuContent: { highlightMessage in
// menu content
MessageMenu {
Button("Copy", action: copy)
.buttonStyle(MessageMenuButtonStyle(symbol: "doc.on.doc"))
Divider()
Button("Reply", action: reply)
.buttonStyle(MessageMenuButtonStyle(symbol: "arrowshape.turn.up.right"))
Divider()
Button("Delete", action: delete)
.buttonStyle(MessageMenuButtonStyle(symbol: "trash"))
}
.padding(.top, 12)
}
1.0.0-beta.1
What's Changed
- Publishers and modifiers regarding keyboard by @jaesung-0o0 in #7
- Updated descriptions by @jaesung-0o0 in #8
Full Changelog: 1.0.0-beta.0...1.0.0-beta.1
1.0.0-beta.0
What's New
- Chat in Channel & Appearance by @jaesung-0o0 in #2
Essentials
- To see the previews, see
/Sources/Previews
- To see the developer documentation, see
/Documentation
- To see the real use cases examples, go to ChatUI-examples
New Contributors
- @jaesung-0o0 made their first contribution in #2
Full Changelog: https://github.com/jaesung-0o0/ChatUI/commits/1.0.0-beta.0