Swiftpack.co - HumorousGhost/TextView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by HumorousGhost.
HumorousGhost/TextView v1.0.2
swifui UITextView
⭐️ 2
🕓 1 year ago
iOS watchOS tvOS
.package(url: "https://github.com/HumorousGhost/TextView.git", from: "v1.0.2")

TextView

This project is only for SwiftUI

Due to the incomplete functions of TextEditor in SwiftUI, such as keyboardType setting, etc.,

UITextView is encapsulated for developers to use

Features will continue to be updated

Preview

image

Supported Platforms

  • iOS 13.0
  • macOS 10.15
  • tvOS 13.0
  • watchOS 6.0

Usage

import SwiftUI
import TextView

struct ContentView: View {
    @State var text: String = ""
    var body: some View {
        TextView($text, isTextCenter: true)
            .font(UIFont.systemFont(ofSize: 12))
            .foregroundColor(UIColor.yellow)
            .returnKeyType(.done)
            .returnKeyAutomatically(true)
            .keyboardType(.asciiCapable)
            .isFirstResponder(true)
            .onDidBegin({
                print("did begin editing")
            })
            .onDidEnd({
                print("did end editing")
            })
            .onShouldBegin({
                print("should begin editing")
                return true
            })
            .onShouldEnd({
                print("should end editing")
                return true
            })
            .onSubmit({ returnKeyType in
                print("click keyboard input button")
                return true
            })
            .background(Color.blue)
            .frame(width: 200, height: 100, alignment: .center)
    }
}

Installation

You can add TextView to an Xcode project by adding it as a package dependency.

  • From the File menu, select Swift PackagesAdd Package Dependency…
  • Enter https://github.com/HumorousGhost/TextView into the package repository URL text field
  • Link TextView to your application target

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