Xcode playgrounds labs remove directions

I am starting to walk throught the App Development with Swift iBook and I have downloaded the App Development Swift Student labs. When I open a lab in Xcode there are directions and then places to write code. Once I start writing code the directions for the first problem disappear and I cant see them again to finish writing the code.


How can I get the directions to stop dissapearing when trying to do the labs?


I am using Xcode version 9.3.

Not sure to understand what you mean. Are directions written in the areas where you type text ?


If so, it is normal ; those texts, written in light gray, are telling you what to type in the field and they disappear as soon as you have started to type something in the field.


If you really need to keep a copy of them, you can take a screenshot before typing.

Thanks Claude31 but they are not text fields to fill out with suggested text.

The lab files open up in Xcode and look something like the example below, inside of Xcode. Using the example below, when I click on line 6 and start to declare a constant, everything above line 6 disappears. It it is not a problem in this example because I can remember. However, where there are multiple instructions it causes a problem.


*********************

Exercise - Constants

Declare a constant called friends to represent the number of friends you have on social media. Give it a value between 50 and 1000. Print out the value by referencing your constant.


6

7


Now assume you go through and remove friends that aren't active on social media. Update your friends constant to a lower number than it currently is.


11

12


***************


I have since sarted to open up a separate blank Xcode Playground to type out the problems but it is an unecessary step and I should be able to do the work in the original lab file.


Thanks

I don't understand your problem.


When I open the playground, I get the following:


/:
## Exercise - Constants

Declare a constant called `friends` to represent the number of friends you have on social media. Give it a value between 50 and 1000. Print out the value by referencing your constant.
*/

/:
Now assume you go through and remove friends that aren't active on social media. Update your `friends` constant to a lower number than it currently is.
*/

/:
Does the above code compile? Why not? Print your explanation to the console using the `print` function. Go back and delete your line of code that updates the `friend` constant to a lower number so that the playground will compile properly.
*/
//: page 1 of 10  |  [Next: App Exercise - Step Goal](@next)


At line 6, I insert the following

let friends = 60
print(friends)


Then I get 60 to display in the log area.


And nothing disappear

/:
## Exercise - Constants

Declare a constant called `friends` to represent the number of friends you have on social media. Give it a value between 50 and 1000. Print out the value by referencing your constant.
*/
let friends = 60
print(friends)
/:
Now assume you go through and remove friends that aren't active on social media. Update your `friends` constant to a lower number than it currently is.
*/
/:
Does the above code compile? Why not? Print your explanation to the console using the `print` function. Go back and delete your line of code that updates the `friend` constant to a lower number so that the playground will compile properly.
*/
//: page 1 of 10  |  [Next: App Exercise - Step Goal](@next)



So, how is it you have

6

7

written in the middle ? Is it something you typed here ?

When I typed my reply above I inserted the numbers '6' and '7' because in the playground it shows them as the lines of code for me to enter my response. You stated at line 6 you inserted "let friends = 60". If I were to do that everything above line 6 disappears and line 6 becomes the first line in the playground. I also get responses in the log area.


I have tried different things, with varied success. Originally when I opened the playground, Xcode would open without the Navigator panel on the left open. If I open it before I start editing code I have better success as the problem is not consistent.


At this point I am just copying everything above the first lines of code I would have to enter in case it disappears. Thank you for your time spent on this. I think I will just operate as is for now. The next lesson is on the Xcode IDE so I am hoping to learn if I am personally doing something wrong.


Cheers

REally hard to understand what happens. Because there is absolutely no reason in the editor that line above the one where you type disappear. Unless if, for any reason, the lines above are selected at the time of typing.

This same issue is happening for me - the first set of instructions disappear as soon as I start typing.

I'd love to know if there's a solution.

Running Xcode Version 9.4 (9F1027a) on High Sierra 10.13.5

The same thing happened to me.


I found that if I used the arrow keys to move right, or down one press, the problem dissapears and I can enter the code without a problem.

So, looks like there is a hidden selection made for the rest of the text.


Should try in XCode 10, which corrected may playgrounds problems.

Xcode playgrounds labs remove directions
 
 
Q