SwiftUI Multiline Textfield?

November 21, 2019 · 2 min read

This week I have been working on a personal macOS application that I use to generate the metadata that appears at the top of markdown files used by Gatsby when generating this very site.

I have a working version that I built with Swift and storyboards before the release of SwiftUI.

I thought it would be a great application to rebuild with SwiftUI to not only learn the new layout language and tools but to also update the application using Catalyst to work on my iPad as well.

Everything was going great until I hit what seemed like a simple problem to solve, a multiline textfield. After doing the Google for a while and reading through some of the usual sites and documentation it became apparent to me that this was going to be more of a problem than I first thought.

As of this post, I still have not found what seems like a simple solution. Either I am missing something really obvious, or there is no multiline textfield yet with SwiftUI?

I need to do more investigation to really find out for sure, but the only answer I have come across so far is to wrap a UITextField for use in SwiftUI. I really am hoping there is a simpler answer.

The work continues to an overlooked obvious control that a lot of applications will need and surely will slow adoption of SwiftUI at this time.

If you know the answer, please feel free to reach out and share it with me on either the contact form or @CompileSwift on Twitter, thanks.

Peter Witham
Peter Witham

Web and Mobile Software Maker, Photographer and Podcaster. I live and breath creativity.
I'd love for you to connect with me via Twitter or if you are a photo person like myself, Instagram.

Related Reads
03-27-2020 Live Stream Highlights

I needed to fix a bug where inserting a pre-coded string was not respecting the attributed string di...

March 28, 2020 · 1 min read

Related Reads
Podcast Season 1 Episode 20 - iPad gets a cursor

It happened, maybe it was inevitable despite Apple’s best effort to say we don’t need it. But the iP...

March 23, 2020 · 1 min read

Related Reads
How to use GitHub with Xcode 11

Xcode 11 and GitHub have come a long way in their relationship, we can now work directly with GitHub...

March 22, 2020 · 1 min read

Related Reads
Live Stream Recording - macOS App Development

As I continue to work on my application I created for personal use, I have a bug that I need to reso...

March 21, 2020 · 1 min read

Related Reads
Using SF Symbols in macOS Applications

SF Symbols is a great library, but it does not play well currently with macOS development. So here i...

March 19, 2020 · 1 min read

Related Reads
Setting NSTextView Font Size Using Swift

When setting the font size of an NSTextView things can get a bit weird with the Attributes Inspector...

March 18, 2020 · 2 min read