CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

SUITextView 0.1.1

SUITextView 0.1.1

Maintained by Oscar Franco.



SwiftUI TextView

SUITextView is a proper SwiftUI MacOS TextView:

  • Has onCommit hook when you press Enter key
  • Inserting new line happens with Shift-Enter
  • It auto expands and readjust with SwiftUI layout
  • After it reaches max height it starts scrolling

After fumbling around for hours and many many stack overflow questions trying to get a simple text area working I've decided to share the joy with other people and hopefully save some hours, macOS SwiftUI is just not getting enough love.

Requirements

Swift, SwiftUI and w/e version of macOS that supports it.

Installation and usage

Install via cocoapods

pod 'SUITextView'

import SUITextView

struct MyAwesomeSwiftUIComponent: View {
  @State text: String = ""

  func onCommit() {
    // do fun stuff with "text"
  }

  var body: some View {
    SUITextView("Type something...", $text, onCommit: onCommit)
  }

}

License

MIT License

Credits

Me @ospfranco

Support

You can consider sponsoring me via github or buying a copy of Tempomat! now on the mac app store!