Where can I find the source code for the Objective-C language? Is it open-source or is there an open-sourced implementation of it available?
It really depends on what you mean by Objective-C, there are compilers, runtimes and libraries for it.
http://opensource.apple.com/ Contains much of Apple's source code for OS X and iOS.
you can also see http://clang.llvm.org/ for a compiler.
GNUstep is an open source implementation of OpenStep (Cocoa).
I think you are asking for Cocoa - and this is not open source. All you have are the header and reverse engineering tools.
Looking around, I've found several copies of Objective-C's source code. Apple maintains it at http://opensource.apple.com/source/objc4/, which is up to date as of OS X 10.9.x Mavericks at version 551.1, but I have also found several repositories GitHub that are copies of this main repository which people have made at various points in time, so they may or may not be as up to date as Apple's main repository. These include the GitHub repositories "opensource-apple/objc4" at version 532.2; "bavarious/objc4," which is up to date at version 551.1; "macmade/OBJC4-437.1-Runtime," which obviously includes just the Objective-C runtime at version 437.1; "Apple-FOSS-Mirror/objc4" at version 532.2; "aosm," which is up to date at version 551.1; "robertvojta/objc4," which is up to date at version 551.1; "j4n0/objc4-532," which is obviously at version 532.0; and "chenniaoc/objc4-551.1," which is obviously up to date at version 551.1. Personally, it seems to me that robertvojta/objc4 is the best repository from which you could possibly fork code due to the fact that it's got every single release from Apple's Open Source website so far copied over to it.
There is no one source code. There would be as many different versions as there are compilers for the language. They would likely be written in a low-level language such as assembly or C, and be vastly complicated. For whichever compiler you are interested in, you will need to confirm that it is open-source, which I find unlikely. Even then, it may be difficult.
Related
I have been trying to answer this question and looking at google/wikipedia etc but have not been able to determine this. On wikipedia I see a reference to Objective-C 2.0 but thats about it. I am curious for example in Xcode 7 there were some new features available for Objective-C like lightweight generics and __kindof. Did these exist before and they were just made available via Xcode in v7? Or did the language change? I tried to find a version history or information on releases but so far have come up with nothing. Swift is clearer on versions/releases and I keep asking myself if I am missing something related to Objective-C since I can't find this information. Does Objective-C update with Xcode releases or can the language evolve on its own?
in Xcode 7 there were some new features available for Objective-C like lightweight generics and __kindof. Did these exist before and they were just made available via Xcode in v7? Or did the language change?
To that extent, yes, the language did change.
The best way to research this sort of feature is by going through the Release Notes for Xcode. Thus, the features you are talking about appear here:
https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html#//apple_ref/doc/uid/TP40016994-CH5-SW1
There is actually an Objective-C section with a subsection "Objective-C Language Changes". That pretty much tells you this was a change in the language!
Changes since then are listed here:
https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html
Of those, the most significant is probably the advent of class properties.
All these changes took place primarily to enhance Swift compatibility, and I think we may expect that all changes in Objective-C going forward will be for that purpose.
Objective-C is a very simple language. It's just a very thin layer on top of the C language. It's very important to realize that if C changes, Objective-C also changes. You can actually select which C dialect will be used for your Obj-C compiler. In that sense Objective-C changes all the time.
If we are speaking only about the object layer, there is no official specification, no discussion groups (e.g. as we have for Swift). It's not open-source. Practically speaking, current Obj-C features are exactly what the Apple's version of LLVM-Clang compiler has implemented (that is, what is shipped with Xcode). And LLVM documentation is where you can find the most interesting pieces of information about Obj-C features.
Obj-C changes a bit with every Xcode release although nowadays new features usually mean more attributes/annotations that can improve code analysis and provide more information to Swift. There is no official version number.
Objective-C has reached a state when it can't be really improved any more. It needs to support everything in C, it has to be backward compatible and its dynamicity makes it very hard to check types. That's exactly the reason why Apple has introduced a new language.
Are there frameworks/generators for producing iOS code from any other language?
A dynamic language like JavaScript, ruby or Python are preferred. Googling for iOS code generators was largely fruitless.
The problem with systems like PhoneGap is that their output is a full-fledged application. What I need to produce is a library (.a & .h file eventually) that other Objective-C developers can reuse in their projects.
RubyMotion may or may not do what you want. I haven't seen much about the practicalities of it yet, but I'm thinking since it's statically compiled chances are good that it can produce libraries that can be simply linked into Objective-C projects. One might need another tool to produce the header files.
Of course, this is all speculation.
I think the best solution for what you're looking for is Titanium. It has its own sdk (in JavaScript), a complete IDE and allows you to have one codebase for all major platforms (iOS, Android included). What it's really awesome is the fact that it actually generates native code (a valid XCode project or a Java one for Android). It's also free and open source. Definetely worth a look.
I've never seen code generators, but there are a variety of "spoofs" as it were.
http://xamarin.com/monotouch - iOS on C#
http://phonegap.com/ - iOS on HTML, CSS , Javascript
http://ipodtoucher55.blogspot.com/2010/06/how-to-create-iphone-apps-in-flash-cs5.html - one of several tutorials for flash on iOS
I've seen links to python libraries and I think java too.
When it comes down to it though, they're all work arounds, not direct development.
I might be asking something strange here, but I'm unsure where to begin. The thing is that I am considering writing a command line tool on a Mac using Obj-C and the Foundation classes.
But there is a very big risk that I would like to be able to compile it for different Linux distributions to run as a server app in the future.
I understand that it is not a problem in itself to compile Objective-C for Linux, but what I don't understand is the API coverage.
As I have understood it so far I can use GNUStep to compile for linux, but is there a good way for me to get an overview of the API coverage? What I mean is, if I use a class that has been added to the Foundation framework in OSX Lion lets say, how big is the risk of that not being available in GNUStep at that time?
I hope I am asking a question that you guys can understand, basically I want to avoid writing an app that can theoretically be compiled for linux, but not in practice because of missing classes etc.
Thanks!
An opinion: The risk is fairly high. GNU Step is an open source project and dependant on its volunteers to keep it up to date. OS X Lion has a small number of additions to Foundation and AppKit.
Your best option if you want it for *nix in the future will be to write it in generic C/C++ and then thinly wrap it in an NSTask if you want a GUI.
You should be able to check if the API's you're using are available by consulting the GNUStep base API docs.
You may want to target GNUStep as your base if compatibillity is a big concern. Compiling for mac should then be rather trivial, compared to moving the code the other way. Of course you always have the option of helping inplement whatever is missing from GNUStep too.
Does anyone know how to setup Objective-C with KDevelop? I've been searching and searching for a supposed "patch", which is supposed to integrate support in with the IDE, yet I haven't been able to find it.
This has been partially treated on StackOverflow already. Apart from the discussion over there, I sometimes use Emacs besides Xcode. I use Emacs for most of my editing and coding needs, and it comes with a nice Objective-C mode. Autocompletion in Xcode is the big selling point, but I just found out there is an answer on Stackoverflow as well. I haven't tried it yet, but it might be worth checking out.
I would go to GnuStep.org, and ask this question on their mailing list. They're the guys who do the most obj-c development on Linux that I know of.
I'm also interesting in developing on Linux using Objective-C. Due to the success of the language on Apple platforms, there are an increasing number of skilled Objective-C Developers whose efforts could benefit OSS if only the gap in Linux tooling were closed.
GNUstep is a fantastic effort and, along with LLVM and Clang, goes much of the way to achieving this. But: there is no modern IDE which supports Objective-C in Linux. ProjectCenter is the official GNUstep IDE but honestly it is showing its age.
JetBrains seem to be in the best position to change this situation: they are producers of the foremost Objective-C IDE for iOS: AppCode, and have just released a C/C++ IDE for Linux called CLion. If enough interest is shown, perhaps they would consider integrating Objective-C support from AppCode into CLion. Compiling against GNUstep, this would breathe new life into cross-platform Objective-C development.
I would encourage anyone interested in this possibility, to sign into JetBrains request tracker and vote for this issue: https://youtrack.jetbrains.com/issue/CPP-3353
I want to update/upgrade the standard Leopard install of Sqlite3 to >3.5 to use the new sqlite_xxx_v2 methods from a Cocoa project.
I can't seem to find any information on how to do this. Does anyone have any tips or a site that outlines the update procedure.
Also is 3.5+ supported on the iPhone. I understand it's embedded so shouldn't be an issue...
What you want to do is grab the amalgamation sources from http://sqlite.org/download.html . Then just compile that into / add it to your project. You don't want to replace the system sqlite- that'll have unintended consequences in other applications. Plus, I'm pretty sure the system sqlite isn't a stock sqlite... Apple has probably made their own modifications to it that core data relies on.
You can read up on the amalgamation stuff here: http://sqlite.org/amalgamation.html , but in short: '''The amalgamation is a single C code file, named "sqlite3.c", that contains all C code for the core SQLite library and the FTS3 and RTREE extensions'''
I'd also suggest not using the sqlite calls directly, they weren't designed to be used that way (says the author of sqlite). Instead, there are a number of cocoa wrappers out there, including fmdb: http://code.google.com/p/flycode/source/browse/trunk/fmdb/ (which I wrote) :)
-gus
You don't really want to upgrade the system version of SQLite on Mac OS X. The reason is that all Mac OS X software is qualified against the versions of the packages that it includes, as built by Apple's build process. Installing a different version of a package, or even building the same version yourself but doing so slightly differently than Apple does, may result in a system that behaves unexpectedly.
Finally, if you embed a newer version of SQLite — or any Open Source library or framework included with Mac OS X — into your own application, you should be sure to integrate the Darwin changes for it from Apple's public source site. That way you can be sure you'll get as close to the same behavior as possible from the library you've built yourself as the version Apple ships, which is especially important when it comes to functionality like file locking in databases.
I don't believe i've updated my version, but it's currently at 3.4.2, and i'm able to use the new methods with the current version.
And i'm running 10.5.5 with the latest (public) iPhone SDK.
It would likely be easier to just drop the library into your project and link it in from there.