Best type of xcode project for objective-c practice?

Is there a simple project like a console where I can hack objective-c and check everything and just print to the console?

I want to practice things like class definition, instances, loop, arrays, dictionaries, etc.

+4
source share
3 answers

If you need Xcode, File -> New Project ... -> Mac OS X / Application -> Command Line Tool / Foundation.

If you like to use Xcode, this is what I do: use your favorite text editor and type

#import <Foundation/Foundation.h> int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // whatever code you want to test NSLog(@"hello, world!"); [pool release]; return 0; } 

compile the shell (e.g. using Terminal.app) with

 clang yourSourceFileName.m -o executableName -framework Foundation 

or

 gcc yourSourceFileName.m -o executableName -framework Foundation 

and then run

 ./executableName 
+10
source

Sure. In the New Project dialog box New Project select Application under the heading Mac OS X, then Command Line Tool . The drop-down selection allows you to select a specific type of project, which is C++ stdc++ by default. Just change it to Foundation , and you will have a template ready to start learning all the frameworks without Cocoa (UI).

Here you can instantiate NSString , NSDictionary , NSArray , NSDate and many other useful classes without a GUI. See the full list here:

+5
source

Yes

In Xcode, under "New Project", select "Application" → "Command Line Tool"

This will allow you to play with objective-C classes and output to the console without the clutter of a fully functional cocoa GUI application.

0
source

Source: https://habr.com/ru/post/1333868/


All Articles