
Chat Composer
A messaging thread with a composer that grows with your text and a send button that morphs in only when there's something to send. On send, the text flies out of the field into a new bubble whose tail forms as it lands, then a typing indicator bounces and the reply pops in.
- input
- animation
- interaction
snippet.swift435 lines
9 files • Scroll to see all →
/// One message in a `ChatComposer` thread.public struct ChatComposerMessage: Identifiable, Equatable { public let id: UUID public let text: String public let isOutgoing: Bool public init(_ text: String, isOutgoing: Bool, id: UUID = UUID()) { self.id = id self.text = text self.isOutgoing = isOutgoing } public static let samples: [ChatComposerMessage] = [ .init("Are we still on for dinner tonight?", isOutgoing: false), .init("Yes! I booked the place by the river", isOutgoing: true), .init("The one with the rooftop terrace?", isOutgoing: false), .init("That's the one. Table for four at 7:30", isOutgoing: true), .init("Perfect. Marta is bringing her brother too, hope that's ok", isOutgoing: false), ]// ... (click "Show full code" to see more)Viewing: Model.swift•1 of 9