### Swift Package Manager Installation Source: https://github.com/jasudev/animatetext/blob/main/README.md Instructions for adding AnimateText as a dependency to your Swift package using Swift Package Manager. ```swift dependencies: [ .package(url: "https://github.com/jasudev/AnimateText.git", .branch("main")) ] ``` -------------------------------- ### Custom Animation Effect Implementation Source: https://github.com/jasudev/animatetext/blob/main/README.md Shows how to implement a custom animation effect by conforming to the ATTextAnimateEffect protocol. This example uses opacity and a delayed animation. ```swift /// Custom animation effect. public struct CustomEffect: ATTextAnimateEffect { public var data: ATElementData public var userInfo: Any? public init(_ data: ATElementData, _ userInfo: Any?) { self.data = data self.userInfo = userInfo } public func body(content: Content) -> some View { content .opacity(data.value) .animation(.easeInOut.delay(Double(data.index) * 0.06), value: data.value) } } ``` -------------------------------- ### Basic AnimateText Usage Source: https://github.com/jasudev/animatetext/blob/main/README.md Demonstrates how to use the AnimateText view with a custom effect. Pass the desired effect type as a generic parameter. ```swift /// A view that animates binding text. Passing the effect type as a generic. /// struct AnimateText where E : ATTextAnimateEffect /// Binding the text to be expressed. @State var text: String = "AnimateText" /// The type used to split text. @State var type: ATUnitType = .letters /// Custom user info for the effect. @State var userInfo: Any? = nil AnimateText($text, type: type, userInfo: userInfo) ``` -------------------------------- ### ATTextAnimateEffect Protocol Definition Source: https://github.com/jasudev/animatetext/blob/main/README.md Defines the ATTextAnimateEffect protocol, which must be implemented for custom text animation effects. It includes required properties for animation data and optional user info. ```swift /// A protocol to implement text animation effects. public protocol ATTextAnimateEffect: ViewModifier { /// Informational data required for each element animation. var data: ATElementData { get } /// Custom user info for the effect. /// The effect maintains a strong reference to this object until it (the effect) is invalidated. This parameter may be nil. var userInfo: Any? { get } init(_ data: ATElementData, _ userInfo: Any?) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.