Playground is not showing result on right bar - swift

I waited long time but my playground project is not showing result on right side bar
I am using right code but still right bar is not updating i don't know what is the problem i tried lot of time.
here is my code
var str = "Hello, playground"
var str1 = "this is my first program"
let kermit = "kermit"
let msPiggy = "ms. piggy"
let string1 = msPiggy + " and " + kermit + ", sitting in a tree"
let string2 = "\(msPiggy) and \(kermit), sittting in a tree "
let string3 = " kermit has \(5*2) fingers"
let chr1:Character = "💿"

As of Xcode 8, unless you are print-ing out things, results in the playground could take a little bit more work to show.
In this screenshot, I show two things you can click on. #1 is the the "Show Debug Area" button, the middle button in the top right of the toolbar (i.e. which toggles the lower pane that slides up and down in the Xcode window). Results from print end up there.
Also, the second set of (multiple) circles shows that you can click on to show results. You can slide the gray bar space wider to make things show.
Lastly, where you see the "Play" triangle in the lower toolbar, try clicking on that to force the Playground to execute your code again.

In my case, I had to close Xcode 9.2 and close all simulators, then restart playground file, then it worked.

I am also facing this problem as shown in below image
There is no log on the right bar
So what we do :
We just Quit Xcode and again open playground project
and it works fine
also, there is one more button through which you can set automatically and manually run

If you have M1 chip MacBook Pro, you have to uncheck Rosetta to get the Playground working.

My result area was somehow too narrow to show the results. Try dragging it larger.

It's not the assistant editor that should be enabled. It's the little grey bar to the right that is too narrow. If you hover your mouse pointer just next to an expected result, you will see the familiar little eye and radio button icon. Then drag the bar out and it'll show.
Hope it works!

I had the same issue, and discovered that if I held down the Play icon above the debug area (revealed at the bottom of the playground), it had an option, 'Automatically Run'.
I selected that, and all is well!
Cheers.

add import PlaygroundSupport to the top of your code! i had the same issue and it worked perfectly.

In Xcode 10.1 I changed build system to Legacy Build System from file > Playground Setting. It fixed my problem

In my case I have two Xcode versions installed on my mac. (v8.2.1 and v7.3.1)
The two Xcode is running simultaneously, and then when I decided to open a playground on v8.2.1 and printed out some codes. Playground should run it automatically but it is stuck in Running my file.
What I did is I restarted both of my Xcode applications and then Playground succesfully printed my codes.
https://forums.developer.apple.com/thread/3672

playground will not show results if any of your previous lines has error, you will have to remove those errors and all the results would immediately start showing up on right side bar.

In my case for Xcode 9.2, output started appearing when I clicked File/New/Tab. So, Playground seems missing some refresh option and new tab did that.

oftentimes, I need to close my playground and Xcode and relaunch it again to see the results.

Also had this problem. "Editor › Run Playground" worked for me.

In my case i ensured i set the right Command Line Tool version by tapping Xcode>Preferences>Locations and it worked.

i made a checklist to resolve this issue
First of all make sure your 'result area' is not hidden, There
should be some grey (result area) on right side, if whole
screen is white then try to pull it from right-edge of screen.
Make sure there is no code error, you can check code error in 'debug
area'.
If both point are resolve though you can not see result then try to
print('hello world') at last.

In my case, I was saving my playground somewhere else than the default path and it didn't show the result. Saving it on the default path made it work.

In my case,
ios: macOS Catalina Version 10.15.7
Xcode
Version 12.1 (12A7403)
1.First Go to Editor then click run playgound
2.Then it will show the running results on the right side.

With Xcode 12+, please uncheck Open using Rosetta.

I saved my playground to the folder of my choosing, all the solutions to save it in default location are simply silly...
I did have enabled the right-hand side area and console-output on the bottom.
Whether running from Edit->Run Playground or using Cmd+Return didn't help, still no output was shown. Even though my code was solid and I could see Build Succeed in the top notificaiton area...
After checking Preferences->Locations I could see there are no Command Line Tools seleceted, so I choosed only one available option (Xcode 13.2.1) and... still no output...
Then I closed XCode with Cmd+Q and started it again...
Finally it worked and output was shown...

Related

Get rid of file icon shadow when file is not saved in Xcode

When a file was just edited and not saved in the Xcode editor the icon of the file in the right pane is darkened a little, and because I have OCD this drives me absolutely crazy and I end up having to click Ctrl+S every time I do anything as simple as commenting a line of code or moving a button 1 pixel in storyboard.
I am using Xcode 10.1 Beta 2, but this happens in all versions of Xcode.
How do you make it so the file is never darkened?
I have the same problem in Xcode and I always command s everything as well. I have looked for a way to disable this, but for now I don’t think there is a way... Maybe they’ll add a way to turn this off in another update soon :)

Why in Xcode 6 doesn't work Assistant Preview?

Sometimes in Xcode 6 Assistant Editor -> Preview stops working.
Showing just "No selection" even if no errors and Storyboard is ok.
Why does this happen?
The reason is "?" (questionmark) in Project's name (maybe there is a bug with other symbols – didn't check it).
You can try to rename Project or just create new one with name without "?" in it.
You must to Kill Xcode from processes for complete and then open it again. You can do it with Activity Monitor o CLI. Voila! - Preview is working again.
Don't just close Xcode keeping the app working. Sometimes also works closing with CMD + Q.
I had similar problem, but fixed it
You must open the xib or storyboard file in both assistant editors. Click the navigation button in the second editor (either the bottom or the right editor, depending on how you stack the assistant editors) and choose Preview to get the preview to appear.
thanks to
http://meandmark.com/blog/2014/09/xcode-6-no-simulate-document-in-interface-builder/comment-page-1/#comment-2883
I have played with Xcode 6 for a while and I encountered similar problems occasionally. I never used special characters in project or class names but the problem sometimes happens.
Now I have to test all ViewControllers at starting point to see if the Assistant Editor work. If not, I will just delete the class file and recreate the same one, it usually fix the problem.
Hope this can be fixed soon.

Xcode 6 Beta / Swift - Playground not updating

I was playing around with the Playground feature of Xcode 6's first beta - and I notice half the time the Playground doesn't update (simply doesn't display the result calculation or how many loop iterations are happening) simple code/loops/functions that are in there. Even the Swift Tour https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html
has several lines of code that don't show up in Playground. If you mess with the code sometimes it will show up, by moving the code around or placing it elsewhere. Anyone else? Any fixes? Is this just a beta problem?
Make sure you haven't inadvertently added an error to your Playground code. Unfortunately, there is no inline notification of an error, and after an error is created, nothing in the Playground will update.
To help with this, open up the Assistant Editor (File > View > Assistant Editor > Show Assistant Editor), which should include a Console Output box. If there are any errors in your Playground, they will show up there. Once corrected, your Playground should hopefully update once more.
That said, it can be a bit slow depending on the complexity of your Playground and its size.
This answer (Undeclared Type 'NSView' in Playground) did it for me (restarting Xcode and the machine didn't help):
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
Had the same strange errors after upgrading to xcode 6 beta 6. For me the problem got fixed with a Product -> Clean. And if that does not fix the errors hold down option key and click again on Product in the Menubar then you will see in the dropdown menu Clean Build Folder... click on that. Or you could download Watchdog app from appstore. This little helper automatically cleans your xcode projects.
You have to be very careful with swift. the language is very case sensitive so while using playground make sure all things are spaced out.
The following code will NOT give you a syntax error but it will stop processing the rest of your code in playground :
for index in 1...5 {
if index %2 !=0{
continue
}
println(index)
}
The error in the code above is in line 2. The code has to be written
for index in 1...5 {
if index % 2 != 0 {
continue
}
println(index)
}
Hope that answers your question :)

nslog stopped working in xcode

I have a strange issue and possibly a bug. My NSLog statements have stopped working completely, they do not print even in view did load, application didfinishlaunching etc. The have all turned a brown colour (the same colour as a pragma mark in xcode) and they all have a warning saying 'expression result unused'. Has anyone ever seen this before or know what to do? Am i running in some kind of weird mode? Im running xcode 4.0.2.
Many thanks
Jules
for completeness, I had the same problem and the answer was different, hope it helps someone else who bumps into this post:
I had a framework (an Amazon one) redefining NSLog, went there (Cmd+Click on the Brown NSLog) and commented out the redefinition...
The actual problem was the release_build set to 1. So it wasn't recognizing nslog, as you said it was set for a release build.
I had the same issue :
what worked for me is given below:
Remove the derived data folder
After removing derived data perform the clean action (You can see this option in the product menu)
Quit the Xcode and start it again.
And this did the trick all my NSLog were working fine.
Hoep this helps
Ensure that scheme chosen corresponds to Debug mode because sometimes the pch file might have some definitions such that logging is done only in the debug mode
(Scheme is on to the left of the place where you select iPhone Simulator / iOS Device)
In the view select Debug Area
(There are 3 view buttons, on the top right hand corner of Xcode, press the center button)
Select "Show variables view and the console"
(In the debug area (bottom) there are ther 3 buttons, press the center button)
I had the same issue and the problem was that I was building an Ad Hoc version (schema was for Ad Hoc build). The warnings disappeared when I built for debug.
Try changing the dropdown menu at the bottom of the console to 'All Output'.
if you are using libraries like 'KScan' or 'iKEA' or 'kdc-scan', so it can happens that, they will call methods like this one 'redirectNSLogToDocuments'.
in my case the object of 'iKEA' call the method 'CheckIfDeviceConnected' and this one redirect all nslog outputs to documents. after commenting out, all nslogs works again :)
hope this will be useful for some one.
some steps :-
1) "Clean all targets" or delete your build and rebuild again.
2) If step 1 doesnt work , reinstall xcode

Xcode 4 is no longer showing me where my warnings are?

Xcode 4 has stopped showing me the locations of build warnings that I have. How can i get it to start showing me them again?
Make sure you're looking in the right place. On the left-hand side of Xcode (4), look for the little error symbol. Click it and enjoy your errors in all their glory.
If you click on the errors and it doesn't take you to the location in code, I think something must be messed up with your Xcode install. I remember you had another question earlier about Xcode problems, so it wouldn't hurt to uninstall & reinstall.
In Xcode 4.3.1. I have one project that doesn't show any warnings, but others do.
So it's not an Xcode issue I guess.
In the Issue Navigator (⌘4) be sure to clear the filter at the bottom left of the screen:
Just click on the x at the right, at the filter will be removed -- worked for me!
Check the below SO post
(iphone) Is there a way to see compile output of xcode4?
press command + 4 for issue navigator. (there are two filter here "By File" and "By Type")