{"id":13496797,"url":"https://github.com/EnesKaraosman/SwiftyChat","last_synced_at":"2025-03-28T19:31:13.701Z","repository":{"id":38740481,"uuid":"266545880","full_name":"EnesKaraosman/SwiftyChat","owner":"EnesKaraosman","description":"SwiftUI Chat UI (Client) Framework \u0026 Documentation to get started!","archived":false,"fork":false,"pushed_at":"2024-04-13T12:39:59.000Z","size":19331,"stargazers_count":250,"open_issues_count":1,"forks_count":46,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-05-01T17:54:02.278Z","etag":null,"topics":["chat","chat-application","chat-bot","chatbot","chatbot-framework","chatroom","inputview","ios","message","messaging","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EnesKaraosman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"enesKaraosman","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-05-24T13:24:29.000Z","updated_at":"2024-06-10T17:30:20.944Z","dependencies_parsed_at":"2023-11-18T09:27:56.957Z","dependency_job_id":"4defec40-03e7-4cf2-847f-c1b757ae40fc","html_url":"https://github.com/EnesKaraosman/SwiftyChat","commit_stats":null,"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnesKaraosman%2FSwiftyChat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnesKaraosman%2FSwiftyChat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnesKaraosman%2FSwiftyChat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnesKaraosman%2FSwiftyChat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EnesKaraosman","download_url":"https://codeload.github.com/EnesKaraosman/SwiftyChat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246088448,"owners_count":20721688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chat","chat-application","chat-bot","chatbot","chatbot-framework","chatroom","inputview","ios","message","messaging","swiftui"],"created_at":"2024-07-31T19:02:00.063Z","updated_at":"2025-03-28T19:31:12.409Z","avatar_url":"https://github.com/EnesKaraosman.png","language":"Swift","funding_links":["https://github.com/sponsors/enesKaraosman"],"categories":["Swift"],"sub_categories":[],"readme":"![Swift 5.8](https://img.shields.io/badge/Swift-5.8-orange.svg)\n\n# SwiftyChat\n\nFor Flutter version check [this link](https://github.com/EnesKaraosman/swifty_chat)\n\n### Content\n* [About](#about)\n* [Features](#features)\n* [Quick Preview](#quick-preview)\n* [Installation](#installation)\n* [Message Kinds](#message-kinds)\n* [Usage](#usage)\n* [Style \u0026 Customization](#style-and-customization)\n\n### About \n\nSimple Chat Interface to quick start with [built-in](#message-kinds) message cells. \u003cbr\u003e\n\n### Features\n- [x] Attributed string support that came with SwiftUI\n- [x] Landscape orientation  support (autoscales message cells with the given `cellWidth` property, if exists)\n- [x] User Avatar (with different position options, optional usage)\n- [x] Dismiss keyboard (on tapping outside).\n- [x] Multiline Input Bar added (investigate [BasicInputView](../master/Sources/SwiftyChat/InputView/BasicInputView.swift))\n- [x] Scroll to bottom.\n- [x] \"Picture in Picture\" background mode video playing (to enable, visit \u003e\u003e Xcode \"Sign in and Capabilities\")\n- [x] Round specific corner of text messages.\n- [x] Implement custom message cells. See [CustomMessage.md](CustomMessage.md) for details.\n- [ ] Swipe to dismiss keyboard.\n\n\n### Quick Preview\n\n\u003cimg src=\"../master/Sources/SwiftyChat/Demo/Preview/swiftyChatGIF.gif\" height=\"240\"/\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eBasic Example Preview\u003c/summary\u003e\n    \n  | Text (Light)      | Text (Dark)  |\n:-------------------------:|:-------------------------:|\n\u003cimg src=\"../master/Sources/SwiftyChat/Demo/Preview/basic-1.png\" width=\"240\"/\u003e | \u003cimg src=\"../master/Sources/SwiftyChat/Demo/Preview/basic-2.png\" width=\"240\"/\u003e\n\u003cimg src=\"../master/Sources/SwiftyChat/Demo/Preview/basic-3.png\" height=\"240\"/\u003e\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eAdvanced Example Preview\u003c/summary\u003e\n    \n  | Contact, QuickReply, Text, Carousel      | Map, Image  | ContextMenu |\n:-------------------------:|:-------------------------:|:-------------------------:\n\u003cimg src=\"../master/Sources/SwiftyChat/Demo/Preview/avatar_contact_qr_carousel_text.png\" width=\"240\"/\u003e | \u003cimg src=\"../master/Sources/SwiftyChat/Demo/Preview/map_image.png\" width=\"240\"/\u003e | \u003cimg src=\"../master/Sources/SwiftyChat/Demo/Preview/contextMenu.png\" width=\"240\"/\u003e\n\n\u003c/details\u003e\n\n\n### Installation\n\nSPM: https://github.com/EnesKaraosman/SwiftyChat.git\n\n### Message Kinds\n\n```swift\npublic enum ChatMessageKind {\n    \n    /// A text message,\n    /// supports emoji 👍🏻 (auto scales if text is all about emojis)\n    case text(String)\n    \n    /// An image message, from local(UIImage) or remote(URL).\n    case image(ImageLoadingKind)\n    \n    /// A location message, pins given location \u0026 presents on MapKit.\n    case location(LocationItem)\n    \n    /// A contact message, generally for sharing purpose.\n    case contact(ContactItem)\n    \n    /// Multiple options, disables itself after selection.\n    case quickReply([QuickReplyItem])\n    \n    /// `CarouselItem`s that contains title, subtitle, image \u0026 button in a scrollable view\n    case carousel([CarouselItem])\n    \n    /// A video message, opens the given URL.\n    case video(VideoItem)\n}\n```\n### Usage\n\n- `ChatView`\n\nHere below is minimum code required to get started (see up \u0026 running)\u003cbr\u003e \nFor detail, visit example project [here](../master/SwiftyChatExample/Example)\n\n```swift\nimport SwiftyChat\nimport SwiftyChatMock\n\n@State private var scrollToBottom = false\n@State private var messages: [MockMessages.ChatMessageItem] = [] // for quick test assign MockMessages.generatedMessages()\n\n// ChatMessageItem \u0026 ChatUserItem is a sample objects/structs \n// that conforms `ChatMessage` \u0026 `ChatUser` protocols.\nChatView\u003cMockMessages.ChatMessageItem, MockMessages.ChatUserItem\u003e(\n    messages: $messages,\n    scrollToBottom: $scrollToBottom\n) {\n    // InputView here, continue reading..\n}\n// ▼ Required\n.environmentObject(\n    // All parameters initialized by default, \n    // change as you want.\n    ChatMessageCellStyle()\n)\n.onReceive(\n    messages.debounce(for: .milliseconds(650), scheduler: RunLoop.main),\n    perform: { _ in\n        scrollToBottom = true\n    }\n)\n// ...\n```\n\n- `InputView`\n\nYou can investigate existing `BasicInputView` in project. \u003cbr\u003eYou can use it if it suits your need, or create a new one.\u003cbr\u003e\nRecommended way is just clone this `BasicInputView` and modify (ex. add camera icon etc.)\n```swift\n\n// InputBarView variables\n@State private var message = \"\"\n\nvar inputBarView: some View {\n    BasicInputView(\n        message: $message, // Typed text.\n        placeholder: \"Type something\",\n        onCommit: { messageKind in\n            self.messages.append(\n                .init(user: MockMessages.sender, messageKind: messageKind, isSender: true)\n            )\n        }\n    )\n    .background(Color.primary.colorInvert())\n    // ▼ An extension that wraps view inside AnyView\n    .embedInAnyView()\n}\n\n// Pass in ChatView\nChatView(messages: $messages) {\n    inputBarView \n}\n...\n...\n```\n\n### Style and Customization\n\n```swift\npublic class ChatMessageCellStyle: ObservableObject {\n    \n    let incomingTextStyle: TextCellStyle\n    let outgoingTextStyle: TextCellStyle\n    \n    let incomingCellEdgeInsets: EdgeInsets\n    let outgoingCellEdgeInsets: EdgeInsets\n    \n    let contactCellStyle: ContactCellStyle\n    \n    let imageCellStyle: ImageCellStyle\n    \n    let quickReplyCellStyle: QuickReplyCellStyle\n    \n    let carouselCellStyle: CarouselCellStyle\n    \n    let locationCellStyle: LocationCellStyle\n    \n    let incomingAvatarStyle: AvatarStyle\n    let outgoingAvatarStyle: AvatarStyle\n    \n}\n```\n\nYou must initiate this class to build a proper style \u0026 inject it as `environmentObject`, \u003cbr\u003e\nAll styles has default initializer; \u003cbr\u003e\n\nFor detail documentation, visit [Styles.md](../master/Styles.md)\n\nYou can also use your own custom message cell, see [CustomMessage.md](CustomMessage.md) for details.\n\n\u003cbr\u003e\nPlease feel free to contribute.\u003cbr\u003e\n\n* Create PR for a feature/bug you'd like to add/fix.\n\n### Inspiration\n\n* UIKit library [MessageKit](https://github.com/MessageKit/MessageKit).\n* SwiftUI library [Nio](https://github.com/niochat/nio).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEnesKaraosman%2FSwiftyChat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEnesKaraosman%2FSwiftyChat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEnesKaraosman%2FSwiftyChat/lists"}