Swiftpack.co - hues0s/TypewrittenText as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hues0s.
hues0s/TypewrittenText 1.0.2
SwiftUI module that extends the Text class providing a vintage typewriter effect.
โญ๏ธ 1
๐Ÿ•“ 1 year ago
.package(url: "https://github.com/hues0s/TypewrittenText.git", from: "1.0.2")


Logo

TypewrittenText

SwiftUI module that extends the Text class providing a vintage typewriter effect.
Report Bug ยท Request Feature


About The Project

Welcome to the TypewrittenText SwiftUI module!

In the past, before voice acting was widely used, text in video games would appear on the screen as if it was being typed out. This added a sense of realism to the dialogue, as it mimicked the natural pace of speech by revealing the words gradually.

Nowadays, this technique is still used in some contexts. For instance, ChatGPT from OpenAI uses type-on text to give the impression of spoken conversation when no actual voice is present.

This Swift Package, built entirely with SwiftUI, is a great way to implement the effect on your iOS projects.

Features

  • Use all the SwiftUI Text class modifiers, as this module is built on top of it
  • Set up the delay between letters to customize the final result


(back to top)

Getting started

Requirements

  • iOS 13.0 or later
  • macOS 10.15 or later
  • watchOS 6.0 or later

Installation

Swift Package Manager

To install the Kit using Swift Package Manager, you can follow the steps below:

  1. In Xcode, select File โ†’ Add Packages...
  2. Paste https://github.com/hues0s/TypewrittenText inside the search box

(back to top)

Usage

Once you have installed the Swift Package, you will need to import it:

import TypewrittenText

And then use the TypewrittenText class initializer, whose parameters are:

TypewrittenText(finalText: String, delay: Double)
  • finalText โ†’ The text you want to type
  • delay โ†’ The amount of seconds the app will take before writing the next letter

The following example shows the code used in the demonstration of the module, where the text is written with a delay of 0.2 seconds:

import SwiftUI
import TypewrittenText

struct ContentView: View {

    var body: some View {
        
        TypewrittenText(finalText: "Welcome, thank you for watching this demo.", delay: 0.2)
            .font(.title)
            .padding()
            
    }
    
}

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

See the open issues for a full list of proposed features (and known issues). If you have a suggestion that would make this better, please:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

This project is distributed under the GNU General Public License. See the LICENSE file for more information.

(back to top)

GitHub

link
Stars: 1
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.0.2
1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics