How to transfer data from a "text field" to a table?

Hi there,

I am quite new to the Swift programming language and having some sort of guidance would be very helpful. At the moment I am trying to create an application that saves information submitted from a textfield onto a table (Hopefully that makes sense). So in other words, I want to be able to write in the 'text field', click a button, and have the data appear in one of the cells, while being in two different controllers. I am not sure if this is even possible, however hopefully with some guidance I could get this to work. As well as that, I hope to keep the information saved, so that the next time you open the Application you will see all the data in the table. At the moment I have no code, because I don't know how to go about coding it. I am making the software for os x.

Here is an image of what I have done so far in the storyboard. Hopefully this helps.

Thanks,

IUtopia.

Replies

>Here is an image of what I have done so far in the storyboard.


Welcome to the forums - while you are free to add images to a comment, others are not allowed to see them.


As an alternative, you can upload to a server and then place the URL here, but know that most outbound URLs are required to be cleared by a moderator, with no firm schedule on when/if they may be cleared later. As an alternative, break the url, like this:


h ttp://www.cnn.com


In the mean time, you may want to start learning Swift via Apple's materials. As well, see the 'Resources' link above.


Good luck.

This is not a Swift question. Your choice of language isn't relevant yet.


What you need to read up on is the model-view-controller architecture in general. What is a data model, who "owns" it, how do you persist it and update it. If you start pasting in code you found somewhere, without fully understanding those principles, it's not going to end well.

Hi Junkpile,

I never stated in this thread about 'pasting in code from somewhere' I just wanted feedback or assistance for how I could go about coding it. I agree, If I'm going to begin developing applications I need to learn from my mistakes, but asking for help can be helpful as well. However, I am starting to regret doing so, at the moment, judging by the guidance given so far. This is just a personal project for myself. I will not publish any of the content of the code or anything, well at least I am not planning to. I am just interested in the development of apps, so I decided to give myself the challenge of developing one of my own. Anyways, I think I have received all the guidance I need so far. Thank you for the post Junkpile.

Sorry if my post came across wrong. Ignore that "pasting in code" bit. The intent of my post was to encourage you to learn about the "bigger picture" of how MVC apps are put together first, before diving into specific code and talking about text fields and table views. Something like the iTunes U Stanford iOS development course would be good. Of course they do illustrate with code but it explains some of the principles along the way. Yes it's iOS but most of the APIs and core concepts are the same.


I'm a bit sensitive about stuff getting posted in the wrong forum too 🙂 Might have been less snarky if this were in Getting Started rather than Swift. The Swift forum is for questions about Swift language features.

Thanks, I am glad you said that. I will be sure to check out the course you mentioned as I progress. I appreciate the encouragement, and I will continue developing apps, till I hopefully will manage to achieve that 'dream app' I wanted to make all along. Sorry if I came across rude before. I hope to see you around on the forums.

Have a good day! 🙂