Equivalent to the Xcode playground in AppCode - appcode

I can not find any references to running xcode playgrounds in AppCode so am assuming that were not possible? Here is what an xcode playground looks like in AppCode: I am not even sure where to find the source code.
Is there any way to run/debug a snippet of swift code in AppCode?

Create a new command line tool project with swift language, you will get a clean project that can run swift code directly.

Playground is not supported in AppCode at this moment (v2022.2): https://www.jetbrains.com/help/objc/ac-mg-xcode-features-unvailable.html

Related

Why the Xcode objective c interface header name isn't found for Swift 4 language

I am currently working on an Objective C project and need few swift files support in it. According to Apple official guidelines, after I create a bridging header, I did this
#import "ProjectName-Swift.h"
to access the swift classes. It didn't work. So, I changed the "Defines Module" to "YES", rewrote the header prefixing with the module name, all to vain. Then I thought of switching the compiling language to "Swift 3" and voila, it works! App runs on the phone.
However, there are few plugins and frameworks that I am also using which don't work with Swift 3. So, no peace here. I need a solution. Help!
So finally after searching the web an another SO post (answer) helped me out. It could be because of bridging issues or compiling thing, I have to "BUILD" the project to get the header generated or something. The solution was from this post https://stackoverflow.com/a/45338549/8102549 or here
Check out your Build settings for Objective-C generated Interface Header Name make sure that the Install Objective-C Compatibility Header is set to Yes. Also, ensure the file name there is as you expect.

Detect Xcode project development language

We can create a new Xcode project using Objective-C or Swift.
I want to detect, which language was selected when a project was created?
Projects can be a mix of Objective-C and Swift, but I am concerned about the language, selected during project creation.
May be it can be through pbxproj file or other better way.
Thanks.
ObjC project always contains the entry point that is main function.
Usually it is inside main.m file but it is not necessary. Developer can replace it to any name.
I tried 2 simple projects. One is in ObjC and second one is in Swift.
When I was tried to add new file the Xcode offered Swift language for Swift project and Obj-C for Obj-C project file.
Next I removed in Swift project AppDelegate.swift file and added AppDelegate.h and AppDelegate.m and (sic!) main.m files. of course I had to create bridging file for obj-c.
Which contains
#import "AppDelegate.h"
I was able to compile this project but when I tried to add new file Xcode offered me to add Objective-C file. But initially the project was created as Swift project.
I did similar manipulation for Obj-C project.
I removed AppDelegate.h and .m file as well as main.m and added AppDelegate.swift
I was asked to create bridge file and did empty file.
Next I went to «Build Settings» and switched Define Module parameter to YES value. (Without this I got linker error).
After it I was able to build and run this initially obj-c project which has AppDelegate in Swift now.
When I tried to add a new file the Xcode offered me to add new Obj-C file too.
So. It looks like you cannot detect initial language based on a parameter in Xcode because project can be always corrected. I think that rarely the developer will try to replace AppDelegate in a project and add\remove main entry point.
Hope this helps you.

(ObjC) Unable to add libraries-Help please

I'm following an objC book and I need to use readline() to obtain a string.
However, before I can even get to that, I need to add the library that contains it. Therefore, I go into Build Phases -> Link Binary With Libraries -> Press the + ->Search and Add addlibreadline.dylib
After I do this, I have an icon under my top-level item that has the name of this library. BUT when I go into my code in main.m, NOTHING is imported. There is no #import
WHY? I have tried different things for hours and am frustrated!
Am I not understanding something about importing and libraries?
Btw: I am using Version 6.1.1 (6A2008a) and Yosemite 10.10.1 (14B25)
Thank you,
Since you've got the libraries linked, try adding this:
#import <readline/readline.h>
Then you should be able to use readline().
http://forums.bignerdranch.com/viewtopic.php?f=148&t=7617

Migrate and add Swift to existing Objective-C project

I have an old project that I built on iOS 7 with Xcode 5. Recently I upgraded to Xcode 6 GM. I opened that project in new Xcode and tried adding this swift code to one of my method in v1Album.m file.
let alertController = UIAlertController(title: "Hey AppCoda", message: "What do you want to do?", preferredStyle: .Alert)
I get an error saying Use of undeclared identified let
I have been searching, trying to see what I need to do, what settings I need to change in my project in order for it to start recognizing swift code. Every tutorial online I see is explaining how to start writing swift code in a brand new project. All I need is to be pointed in the right direction.
EDIT:
What I have read so far on migrating project to swift from Apple Doc here is that
in order to write swift code I need a brand new swift class
I need to rewire all my objective-c code from v1Album.m to v1Album.swift
Then I deselect v1Album.m from my project.
I cannot use swift code directly in v1Album.m without first defining that method in v1Album.swift file and then using a bridging header.
Basically I cannot do what I am trying to do i.e. write straight up swift code in *.m file.
Please correct me, I maybe completely wrong.

How to add libclang to xcode?

I would love to do some syntax coloring and code completion on any given code. Ideas inspired from Apple video http://devimages.apple.com/llvm/videos/Libclang.mov
Can anyone tell me about a sample project which uses libclang to parse objective-c code?
Have a look at the Étoilé project: http://etoileos.com/news/archive/2010/10/15/1401/
There you'll find SourceCodeKit that integrates clang for syntax highlighting.
(Source: http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Languages/SourceCodeKit/ )