SwiftyChat Project Overview
SwiftyChat is a straightforward and efficient chat interface that is designed to jumpstart the development of chat applications. It's a powerful Swift-based framework that comes with built-in message cells, offering a fast and customizable way to integrate chat functionality into your app.
Features
SwiftyChat is packed with features to enhance user experience and developer flexibility:
- Attributed String Support: Leveraging SwiftUI's capabilities, SwiftyChat supports richly formatted text messages.
- Adaptable to Landscape Orientation: Message cells automatically adjust to fit the screen in landscape mode for a seamless viewing experience.
- User Avatar Display: Integrate user avatars in chat, with options for positioning based on your needs.
- Easy Keyboard Dismissal: Simply tap outside the text area to dismiss the keyboard, improving usability.
- Multiline Input Bar: This feature is crucial for lengthy messages and is implemented with the
BasicInputView
. - Scroll to Bottom Functionality: Ensures users can quickly access the latest messages.
- Picture-in-Picture Mode: Enhances user engagement with video content by allowing background playback.
- Message Corner Rounding: Customize the appearance of text messages by rounding specific corners.
- Custom Message Cells: Developers can implement their custom-designed message cells for a unique app experience.
- Keyboard Dismiss on Swipe: Future updates will include keyboard dismissal with a swipe gesture.
Quick Preview
SwiftyChat provides visual previews to demonstrate its versatility:
- Basic and advanced examples are provided, showcasing text in light and dark modes, alongside diverse message types such as contacts, quick replies, images, maps, and more.
Installation
SwiftyChat can be easily integrated into your project via Swift Package Manager through its GitHub repository: https://github.com/EnesKaraosman/SwiftyChat.git
.
Message Kinds
SwiftyChat supports a variety of message types—each designed to cater to different communication needs:
- Text: Standard text messages with support for emojis.
- Image: Both local and remote images are supported.
- Location: Share locations and view them on an integrated map.
- Contact: Easily share contact information.
- Quick Reply: Offers clickable response options.
- Carousel: Showcase a scrollable view containing items like images, titles, and buttons.
- Video: Share video links that users can view directly within the chat.
Usage
To get started with SwiftyChat, minimal code is required. Set up involves importing relevant modules and initializing chat messages and users. The ChatView
handles displaying messages, while the InputView
facilitates message input. Custom input bars can be developed by modifying templates like BasicInputView
.
Style and Customization
SwiftyChat offers a high degree of customization through ChatMessageCellStyle
, allowing developers to tailor every aspect of the chat interface:
- Customize text styles for incoming and outgoing messages.
- Define unique styles for different message types like contacts and images.
- Modify the appearance of avatars for both senders and receivers.
Each customizable element comes with default settings, but developers can adjust these to fit the specific design and functionality needs of their application.
Contribution and Inspiration
Inspired by libraries such as MessageKit and Nio, SwiftyChat encourages contributions from the developer community. Developers can propose new features or fix bugs through pull requests, fostering a collaborative environment to enhance the tool continually.