Swiftpack.co - Package - kenmueller/TextView

TextView

The missing TextView in SwiftUI

Download

  • File -> Swift Packages -> Add Package Dependency...
  • Select your project
  • Enter https://github.com/kenmueller/TextView for the package repository URL
  • Select Branch: master
  • Click Finish

Inputs

  • text: Binding<String>
  • isEditing: Binding<Bool>
    • The TextView will modify the value when it is selected and deselected
    • You can also modify this value to automatically select and deselect the TextView
  • textAlignment: TextView.TextAlignment = .left
  • font: UIFont = .preferredFont(forTextStyle: .body)
    • By default, the font is a body-style font
  • textColor: UIColor = .black
  • backgroundColor: UIColor = .white
  • contentType: TextView.ContentType? = nil
    • For semantic purposes only
  • autocorrection: TextView.Autocorrection = .default
  • autocapitalization: TextView.Autocapitalization = .sentences
  • isSecure: Bool = false
  • isEditable: Bool = true
  • isSelectable: Bool = true
  • isScrollingEnabled: Bool = true
  • isUserInteractionEnabled: Bool = true

Example

import SwiftUI
import TextView

struct ContentView: View {
    @State var input = ""
    @State var isEditing = false
    
    var body: some View {
        VStack {
            Button(action: {
                self.isEditing.toggle()
            }) {
                Text("\(isEditing ? "Stop" : "Start") editing")
            }
            TextView(text: $input, isEditing: $isEditing)
        }
    }
}

Github

link
Stars: 28

Dependencies

Used By

Total: 0

Releases

v1.2.0 - 2020-01-06 03:28:17

Added platforms to Package.swift

cb641ab266110069409c1da945333742b98487f2

v1.1.0 - 2019-11-17 19:51:52

Removed second init and updated README for new inputs

Commit d1dc2006fa5a1ddbe458ab730a39569260c4ffc1

v1.0.0 - 2019-11-17 19:21:48

Version 1.0.0

Commit e0c3dda235a66b245e9f03b3619c0be293e1a182