App Development with Swift Book - stuck at unit 4.3

Dear all,


I am trying to learn how to code with Swift, I really want to and, to start, I completed the Intro to App Development with Swift. So far, so good ...

I then passed to the App Development with Swift book as it was supposed to be a step up (at least in difficulty).

I completed the first 3 units and started the 4th a few days ago.


I am now stuck at unit 4.3 (Model View Controller) during the Lab at the end of the unit.

No matter what I write (even if I try to copy exactly what is in the 'solution' project) I keep getting an error when trying to create Outlet(s) from the main.storyboard's text fields to the AthleteFormViewController.swift file. This error says:


Could not insert new outlet connection: Could not find any information for the class named AthleteFormViewController (all of this in red color).


This is the second consecutive exercise that I would have to abandon because following the EXACT instructions given in the book puts me into a dead end.

Then I confront with the solutions, try them and ... in my project they also do not work.


Could you please help me if you have completed this project?

Or please show me another way of learning how to code. Books, Videos, Courses, whatever ...


Thank you


Yours,


Michele

Answered by KMT in 300868022

>Could not insert new outlet connection: Could not find any information for the class named


Seen this SO thread?


https://stackoverflow.com/questions/29923881/could-not-insert-new-outlet-connection-could-not-find-any-information-for-the-c


Otherwise, I couldn't locate this as a common issue w/this particular lesson (which has been around since 4.2017, updated 9.2017) - I looked it over in v2.0.1 of that ibook, and nothing jumped out to me as blatantly wrong in the instructions, in which case I'd consider the odds are more towards an editing issue in your example, likely found/fixed by one of the suggestions in that SO thread, the easiest of which to try is: Use Xcode's Product menu, then, with the option key pressed, select 'Clean Build Folder'. Confirm no errors in the navigator and go again.


Good luck.


Ken

Accepted Answer

>Could not insert new outlet connection: Could not find any information for the class named


Seen this SO thread?


https://stackoverflow.com/questions/29923881/could-not-insert-new-outlet-connection-could-not-find-any-information-for-the-c


Otherwise, I couldn't locate this as a common issue w/this particular lesson (which has been around since 4.2017, updated 9.2017) - I looked it over in v2.0.1 of that ibook, and nothing jumped out to me as blatantly wrong in the instructions, in which case I'd consider the odds are more towards an editing issue in your example, likely found/fixed by one of the suggestions in that SO thread, the easiest of which to try is: Use Xcode's Product menu, then, with the option key pressed, select 'Clean Build Folder'. Confirm no errors in the navigator and go again.


Good luck.


Ken

Are you sure you have the correct version of Xcode for the book? (This is the iBooks book, right?) Because of ongoing changes to the Swift language, using a newer Xcode might not be compatible with the book version.


Assuming you have an AthleteFormViewController scene in your storyboard, try going to the Identity inspector on the right (View -> Utilities -> Show Identity Inspector, or Command-Option-3) and look at the Module text field immediately below the Class field at the top. Normally, this should be empty of user-entered text, and the checkbox "Inherit module from target" should be checked.


The other possibility is that errors elsewhere in your app are preventing Xcode from recognizing your view controller reference. Apart from this connection, does you project build without errors?


Anyway, if you can tell us your Xcode version and the revision date of the book (usually in the back), someone might be able to try it and see what's gone wrong.

Are you sure you have declared the view where you want to create the outlets to be of class AthleteFormViewController ?

Thank you, Quincey.


I confirm that the AthleteFormViewController scene has all the options as you suggest.


I am using Xcode 9.2 but have installed also 9.0 and 8.3.2 if it can help.


It seems after inputting the Oulets manually the errors didn't show up but the app is building with errors because there is a part later in the lesson that should be implemented. I just find the instructions very confusing. I may not be the sharpest aspirant-very-beginner programmer around but I would really appreciate if they would just say "in this file at around this position write ..." not just "implement the bla bla bla" ... It really makes me feel lost in the middle of nowhere ...


The book version is the latest one as of writing: 2.0.1, as KMT above stated.


Thanks for your support!

Just to be sure I understood: how should I "declare a view"?

The base of the project was already provided as this seems to be 'just' a LAB where to get your hands dirty with the MVC concept.


If I go into main.storyboard and select the AthleteFormViewController, in the Identity Inspector it shows that the class is exactly that one.

Am I missing something else?


Forgive me for asking something that may sound so basic ... I am really trying to learn ...

Thank you.

That's OK, you are not missing anything here.


Let's check step by step, even if it appears trivial


you have created a textField in the view of the controller

Does the object appear in the list on the left, in AthleteFormViewController ?


You control-drag from this object into the code:

Could you post here the complete code of AthleteFormViewController

And explain where you try to insert the IBOutlet


If you control-drag from the object name in the list on the left, do you succeed to create the outlet ?


If that does not work,

- declare first the IBOutlet in code

@IBOutlet var test : UITextField!

- drag from the white circle on the left to the textField in IB.

Does it work ?

Thanks Claude, in the end I have opened two windows one next to the other, one with my project and one with the solution and filled in the missing parts while checking that all of the settings were the same.

I tried to understand and "learn" as much as possible from copying - even if that doesn't sound so good 🙂 ...!


Everything seems to work now and the app builds without errors.

It is only funny that both in the solution and -obviously- in my project there is an @IBAction which is connected to nothing (white circle) and the app still works. That action is the one that the tutorial says it should be connected to the Exit on the View Controller. But it is not clear from where I should drag (in the book this really isn't clear)... it seems that also the guy who compiled the guide was confused by his own words and left the Action disconnected.


After the cleaning suggested by KMT above the Oulet creation works as well as everything else.

Mine was more a frustration caused by not understanding the instructions ...


Thanks for your help!

App Development with Swift Book - stuck at unit 4.3
 
 
Q