Where is the Swift CocoaTouch documentation? - cocoa

I imagine the Swift language has gotten the attention of a boatload of iOS programmers - many of whom never wrote a single line of Objective-C in their life.
For example I have dozens of apps on the app store, written in Titanium.
In the Titanium world every property and event available is documented, for example like this for UILabel:
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.Label
Is there an Apple equivalent? I read the Apple iBook on Swift - it discusses the core language, it doesn't list out the methods available in the Cocoa touch framework, and leaves it to the programmer to intuitively guess based on their Objective-C experience.
Is that a fair assessment, that that you have to learn Objective-C first and then use that as a bridge language to Swift - or is Swift intended to be stand-alone? If so, where is the documentation of Cocoa Touch, in swift?

The documentation is included in Xcode6 (or can be downloaded). You can currently access it by going to Window -> Documentation and API Reference. (or by pressing shift, command & 0)
You will then have full access to search and find resources here. You can also option click on something in Xcode to pull up the docs for that specific thing.
As you will see it shows you the declarations for Obj-C and Swift together. This technically isn't Swift documentation (it is the iOS8 library documentation) but it should be similar to what you were looking for.
Note: this post originally included screen shots but I removed them as developers are not supposed to post screen shots of pre-released software.

The Cocoa Touch APIs and frameworks are the same between Swift and Objective-C. There are only minor syntax differences used when you call the APIs. The framework documentation is currently pre-release, so if you aren't a registered developer then you can't see it yet.

Related

Any way to view doc for c API in Xcode?

I suddenly found Xcode have very poo support for view the C API docs.
Suppose if you want to find the definition for fopen, you can't find any meaningful info for this function expected the declare.
So any workaround for this?
Edit according to Mark Szymczyk's suggestion.
My problem is when I Option click the function, it just show this function is declare in stdio.h, no more explanation to this function like other cocoa APIs.
And when I search in the documentation viewer, it shows something like this, this will cost a little time to figure out it.
There is no solution for you with Xcode. Apple's top priority with Xcode is developers of apps on Apple's platforms using Apple's technologies. That priority also applies to documentation. For standard C language APIs, Apple supplies man pages. If that is not good enough, you're out of luck.
A possible solution is to use Dash, a documentation viewer app. If you can find a comprehensive documentation set for the C language APIs, you could import it into Dash and read it from there.

How much legacy Objective-C code can Hyperloop work with?

Hyperloop looks like an exciting way forward for Appcelerator. I've read the very basic Hyperloop docs and watched the intro video. In the intro video I can see that simple Swift or Objective-C files can be used,
I'm interested to find out how much of an exisiting Swift/Objective-C codebase could be dropped into a Hyperloop project?
Could we for example, take an entire project written in Swift/Objective-C and work on it using Hyperloop?
Does anyone have any hands on experience?
Cheers!
You can potentially use a lot of the code but you can't (today) easily drop in a full xcodeproject without a bit of work.
If you look at the example iOS project that comes alongside Hyperloop (http://labs.appcelerator.com/project/55f74a9f421c44837717716b/Hyperloop-Module) you can see some drop in examples of both swift and objective-c code.
I recommend looking at the examples at Loop Modules since they provide a lot of how-to for using Swift-Objective C in Hyperloop. From my own experience, you can't drop and drag a current X-Code project, every piece that is integrated into Hyperloop works as a module (they call it framework, but for me it is a module) which needs to be adapted to be used inside Titanium.
My personal experience, with enough tinkering (or knowledge) you can integrate any native Swift-Objective C component you want. I even went as far as compiling source C and integrating that in Hyperloop and calling the functions in that with C as well.
Currently I'm using Javascript, Swift, Objective-C and C in the same project and it works great so far :)
Also the latest documentation from Appcelerator is here
Another good news is Hyperloop is now available to the free Indie program at Appcelerator.

Scripting iTunes: playing single tracks

I’m working on an app where I want to signal iTunes at certain times to play single tracks from whatever playlist happens to be active. I’ve just started studying Scripting Bridge, I’ve used the command-line tools Apple references to create an “iTunes.h” file, and I’ve got this and ScriptingBridge.framework in my project. Now I thought all I would have to do is
iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:#"com.apple.iTunes"];
and when I want to cue whatever track is up next:
[iTunes playOnce:YES];
iTunes does respond, but if I understand Apple’s sample code, the YES parameter should compel it to play one and only one track. In fact, it doesn’t seem to matter whether it’s YES or NO: iTunes always plays from the selected track to the end of the playlist, however many tracks that may be. Am I missing something? And since I need to send only one very simple Apple Event, is there a simpler way to do this than going through the whole Scripting Bridge framework?
In Mac OS X 10.6 Snow Leopard Apple introduced the AppleScriptObjC framework which provides a much simpler bridging between AppleScript and Cocoa. No more ugly header files.
In the script classes you can mix AppleScript with an Objective-C like syntax.
There is an AppleScriptObjC template in Xcode, but you can add ASOC to an existing Cocoa project by adding the AppleScriptObjC framework and call in main.m
[[NSBundle mainBundle] loadAppleScriptObjectiveCScripts];
The Apple documentation is quite poor, there are some resources on macosxautomation.com, a comprehensive book written by Shane Stanley is available there, too.

How do I code applications on a Mac so that they use the native UI elements?

I'm starting to program. Already did some things with Java: a calculator, one document management system powered with a database and some other home projects. But I don't like the visual look. I love however how mi Mac's Apps look. And I want to create Apps for mac. Already buy one but when I open netbeans to program it looks like the Apps doesn't feel like mac.
Is there any specific java code to make the controls looks like how the other mac apps look? My dad mention something about Object C but I don't understand. Can someone please explain me.
AFAIK You'll never get the look and feel of Aqua (Mac's UI Kit) by using Java. Why? Because to make Java platform independent some things needs to get ripped off. And native controls are one of them.
I think you're taking about Objective C which is the native development language for building Mac Apps. I'll recommend you the book "Learn Objective-C on the Mac" is pretty useful.
P.S. I'll encourage you to start with iOS (iPhone and iPad apps). Why? Well, I think is easier to begin with. Things like fixed resolution and so on make your development efforts small while beginning with. (Just my 2 cents)
If you want to code in Objective-C, you'll first need to trek over to the App Store and download Xcode. This will install C/C++/Objective-C compilers on your Mac and then you can start getting your hands dirty.
Depending on what you are trying to accomplish, you can just google/read/learn and build your own frameworks from the ground up or look at something like Cocoa to get started as well.
http://developer.apple.com/technologies/mac/cocoa.html
Cocoa Frameworks
The Cocoa frameworks consist of libraries, APIs, and runtimes that form the development layer for all of Mac OS X. By developing with Cocoa, you will be creating applications the same way Mac OS X itself is created. Your application will automatically inherit the great behaviors and appearances of Mac OS X, with full access to the underlying power of the UNIX operating system. Using Cocoa with the Xcode IDE is simply the best way to create native Mac applications.
Good luck!
Apple has deprecated a lot of the Java support in OS X. It's possible to have a Java application integrated, but there are some annoying bits missing. See one of my questions demonstrating some issues with Java applications in the Dock. You would be better off using Objective-C instead, since Apple has lots of documentation and tutorials available.
You're thinking of Objective C. You can also do applications for Mac using C/C++ but as of late the "popular" language for Mac development is Objective-C. There are tons of tutorials and plenty of documentation to walk you through writing apps for both Mac and iOS.

Starting programming Mac OS X

I'm starting a Mac OS X app that will connect to a small website I'm currently developing.
The idea is that the app will store a number of snippets on a local database and then sync with the website whenever it can.
So my questions are:
Carbon or Cocoa?
SQLite for local storage / another solution?
Is there any decent free text-editor control with basic syntax highlighting to embed on the app?
For new projects you should use Cocoa. Carbon is only useful to port already existing apps.
Cocoa brings it's own database backend called Core Data. It's quite simple to use but at the same time really powerful.
For syntax highlighting use a NSTextField, they are really powerful in Cocoa. One can even write highly graphical applications like Pages with it. For some examples of syntax highlighting see syntax highlighting on cocoadev.
You could also have a look at how other editors do it. For example there's Smultron, which is discontinued for the moment.
If you know ruby you can try out MacRuby. This let's you use ruby with the Cocoa classes. I'm quite sure that ruby will be the second programming language for the Mac because of its similarities to Objective-C.
At this point in each product's lifecycle, there is not really any compelling reason to use Carbon.
It's a fine API, and fine applications are written using it (Photoshop, iTunes), but a 64 bit version has not been made available, and it just seems that the writing is on the wall.
If you are just learning, and you want your knowledge to transfer to new projects in the future, Cocoa all the way.
Carbon is being phased out. You should really go for Cocoa.
Cocoa has its own database solutions (a flavor of SQL I think).
Cocoa. Carbon is going the way of the dodo and is only available in 32 bits.
And Xcode is free, with lots of syntax highlighting ;)
Check out this link for info about syntax highlighting in cocoa

Resources