0

Lots of iOS development tutorials are full of "just copy this and your button will work" or "this code does this, just copy it and change some variables". I'm trying to learn everything from scratch so it makes the best possible sense. Turns out I can't find any information about Xcode compiling and linking process. And also, I would like to understand how the macros like IBAction are translated exactly. I've found something here, but it does not explain entirely. I want to see the code when its fully assembled with its headers and so...

Is there a way to program for Xcode just with code? I mean, to insert and link all objects with code, no visual processes used.

Does anyone know a good book about this?

Jorge
  • 2,530
  • 1
  • 19
  • 28

1 Answers1

1

Here are some answers to your questions!

Anything that you can do in InterfaceBuilder you can do in code, yep. Configuring view objects is a bit repetitive and ends up being a lot of code for something easy (once you know what options you have) which is why the IB tool is there.

The IBAction flag is actually only used by the IDE to provide assistance in generating the xib so when the file is unarchived, the properties it sets will line up. It's not foolproof as you can make a property, set the outlet, then delete the property and your app will crash!

You can see the output of pre-processor macros by selecting Product -> Perform Action -> Compile/Analyze/Preprocess/Assemble. These are all handy tools to see what Xcode is building under the hood.

Compiling and linking is not too important for iOS development since Xcode is the only tool you use to build your application (with the exception of xcodebuild command) and it handles that all for you. If you do want to dig in deeper, I don't know of a good reference but googling LLVM (the toolset to compile/debug/link/etc) would be a good starting place.

Acey
  • 8,048
  • 4
  • 30
  • 46
  • 1
    Worth mentioning that `IBAction` is a macro for `void`, and it lets the IDE know which methods are actions that can be displayed in the .xib/storyboard editor. Losing the last paragraph wouldn't hurt -- compiling and linking are just as important as in any other development, but as with other IDE's you don't have to do each step manually. Output from the compiler and linker are available in the IDE. – Caleb Nov 11 '14 at 19:02