Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Swift and 10.14 - displaying the contents of a string in a TextView or TextField

Swift and 10.14 - displaying the contents of a string in a TextView or TextField
Thread Tools
Addicted to MacNN
Join Date: Aug 2006
Location: The deep backwoods of the PNW
Status: Offline
Reply With Quote
Sep 25, 2022, 05:52 PM
I can't seem to get my Swift questions answered on StackOverflow, so maybe one of y'all can help me with something that seems like it should be pretty easy to accomplish.

I am using Swift in Xcode 10.3 on MacOS 10.14.6. I am NOT using UIKit as far as I know - all my types are prefixed with NS. I'm also not using the storyboard method of building the UI, because right off the bat it was just way too convoluted for my needs. I'm too used to the Visual Studio way of doing things, where you can double-click on a form element to access the function it uses immediately, instead of this weird drag-and-drop targeting thing between my .xib and .swift files.

My goal is to take the contents of a changelog text file and display those contents in a window with a text control (it's plaintext, so whatever control is best will work, I've been playing with NSTextField and NSTextView). I've gotten far enough to read the text file into a variable, but I cannot for the life of me figure out how to assign those contents to my form/window element.

I figured out I can use self.view.window? to access details about the window, but I can't figure out how to extrapolate that to access the text field in that window.
Sell or send me your vintage Mac things if you don't want them.
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Privacy Policy
All times are GMT -4. The time now is 07:53 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,