![]() To display the context menu for chat messages, you need to attach a long-press gesture to the message bubbles. Display the Context Menus and Reactions Using the Tap-and-Hold Gesture To allow users to refresh the contents of the list, apply the refreshable modifier to it, creating the “pull-to-refresh” effect. You can do this with the refreshable modifier in SwiftUI. ![]() Since this is a long scrolling list, you can improve the user experience so that when users perform a standard drag gesture on the list, it displays a visual cue that shows the content is updating. listStyle modifier and set its parameter to. For example, to convert the list to a plain list, add the. You can change the appearance of the list using list styles. By wrapping the container views in the List view, the content becomes scrollable by default. The ChannelListData file creates the composition of the list using the layout containers HStack, ZStack, VStack, and Spacer. The list pulls data from another Swift file called ChannelListData.swift, which can also be found in this project. In the project’s folder structure, look for the folder ChannelList and the Swift file, ChannelListView.swift. You can also find the code of the list by downloading the project from GitHub. A list view displays data in several rows and arranges the rows in a single column.Īfter creating your Xcode project, create a new Swift file called ChannelList.swift and enter the following code: In SwiftUI, you can make interface elements automatically scrollable by embedding them in a List layout container. How to Make the Channel List Scrollable and Refreshable Want to learn more about SwiftUI? Check out our SwiftUI Chat tutorial to see how you can get started and integrate it into your project. There are several files and folders in the Xcode project, but the following are the Swift files you’ll need: You can also download the project files from this GitHub repo and follow the sections below to begin creating the interactions in this project. If you don’t have Xcode installed, download it from the Mac App Store. You need to download and install Xcode (13+) to run the project files. After you’ve caught up, feel free to dive into part two, or check out our SwiftUI Chat Application to learn more. If you haven’t yet, review part one of this series, Prototyping Stream’s iOS Chat SDK With SwiftUI: Part 1. You’ll also apply modifiers to these gestures so you can control every aspect of your app’s touch interactions, resulting in a truly customized app with a seamless user experience. In part two of this series, you’ll use our iOS Chat SDK sample application to prototype several gestures that you’ll use for refreshing page content, adding seamless swiping and pagination to message lists and photos, revealing in-app actions to messages in message channels, and more.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |