Swiftpack.co -  EnesKaraosman/SwiftyChat as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
SwiftUI Chat UI (Client) Framework & Documentation to get started!
.package(url: "https://github.com/EnesKaraosman/SwiftyChat.git", from: "video-cell")

Version Swift 5.3




Simple Chat Interface to quick start with built-in message cells.
Fully written in pure SwiftUI.


Quick Preview

Basic Example Preview

| Text (Light) | Text (Dark) | :-------------------------:|:------<img style="max-width:100%;" src="https://raw.github.com/EnesKaraosman/SwiftyChat/master/---------:| | <i <img style="max-width:100%;" s

Advanced Example Preview
Contact, QuickReply, Text, Carousel Map, Image ContextMenu


SPM: https://github.com/EnesKaraosman/SwiftyChat.git

Message Kinds

public enum ChatMessageKind {
    /// A text message,
    /// supports emoji 👍🏻 (auto scales if text is all about emojis)
    case text(String)
    /// An image message, from local(UIImage) or remote(URL).
    case image(ImageLoadingKind)
    /// A location message, pins given location & presents on MapKit.
    case location(LocationItem)
    /// A contact message, generally for sharing purpose.
    case contact(ContactItem)
    /// Multiple options, disables itself after selection.
    case quickReply([QuickReplyItem])
    /// `CarouselItem`s that contains title, subtitle, image & button in a scrollable view
    case carousel([CarouselItem])
    /// A video message, opens the given URL.
    case video(VideoItem)


  • ChatView

Here below is minimum code required to get started (see up & running)
For detail, visit example project here

@State var messages: [MockMessages.ChatMessageItem] = [] // for quick test assign MockMessages.generatedMessages()

// ChatMessageItem & ChatUserItem is a sample objects/structs 
// that conforms `ChatMessage` & `ChatUser` protocols.
ChatView<MockMessages.ChatMessageItem, MockMessages.ChatUserItem> {
    // InputView here, continue reading..
// ▼ Required
    // All parameters initialized by default, 
    // change as you want.
  • InputView

You can investigate existing BasicInputView in project.
You can use it if it suits your need, or create a new one.
Recommended way is just clone this BasicInputView and modify (ex. add camera icon etc.)

// InputBarView variables
@State private var message = ""
@State private var isEditing = false

var inputBarView: some View {
        message: $message, // Typed text.
        isEditing: $isEditing,
        placeholder: "Type something",
        onCommit: { messageKind in
                .init(user: MockMessages.sender, messageKind: messageKind, isSender: true)
    .padding(.bottom, isEditing ? 0 : 8)
    // ▼ An extension that wraps view inside AnyView

// Pass in ChatView
ChatView(messages: $messages) {

Style and Customization

public class ChatMessageCellStyle: ObservableObject {
    let incomingTextStyle: TextCellStyle
    let outgoingTextStyle: TextCellStyle
    let incomingCellEdgeInsets: EdgeInsets
    let outgoingCellEdgeInsets: EdgeInsets
    let contactCellStyle: ContactCellStyle
    let imageCellStyle: ImageCellStyle
    let quickReplyCellStyle: QuickReplyCellStyle
    let carouselCellStyle: CarouselCellStyle
    let locationCellStyle: LocationCellStyle
    let incomingAvatarStyle: AvatarStyle
    let outgoingAvatarStyle: AvatarStyle

You must initiate this class to build a proper style & inject it as environmentObject,
All styles has default initializer;

For detail documentation, visit Styles.md

Please feel free to contribute.
* Create PR for a feature/bug you'd like to add/fix.




Stars: 73
Last commit: 2 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

19 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics