Xcode Logos: Difference between revisions

From iPhone Development Wiki
No edit summary
 
(13 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Using logos and theos with xCode ==
== Using Logos and theos with Xcode ==
Theos and logos were designed to allow developers to do iOS development without xCode, but many developers including me prefer to use xCode because of it's code highlighting and code completion.
[[Theos]] and Logos were designed to allow developers to do iOS development without Xcode, but many developers instead prefer to use Xcode because of its code highlighting and code completion functionality.
On this page I would like to collect methods and ways on how to integrate xcode and theos and use it more efficiently.
This page contains methods to integrate Xcode with Theos.
 


===crash-x's method ===
===crash-x's method ===
<br />
I am sure many people have or will figure out better ways on how to do this, but for now I just want to get this started.  
I am sure many people have or will figure out better ways on how to do this, but for now I just want to get this started.  
What I am posting is far from perfect, but is useable and I am sure it will be useful to some.
What I am posting is far from perfect, but is useable and I am sure it will be useful to some.
I am using xCode just as a code editor and let theos handle everything else.<br />
I am using xCode just as a code editor and let theos handle everything else.<br />
'''The basic steps are:'''<br />
'''The basic steps are:'''<br />
1. Use an xCode project as a wrapper<br />
1. Use an Xcode project as a wrapper.<br />
2. Logos .xm files have to be .mm files with .xmi symlinks<br />
2. Logos .xm files have to be .mm files with .xmi symlinks.<br />
3. Work around logos % directives breaking code completion<br />
3. Work around logos % directives breaking code completion.<br />
 


==== 1. xcode project wrapper ====
==== 1. xcode project wrapper ====
I am simply using L0CKnL0aD7's wrapper. Instructions on the github page
I am simply using LnL7's wrapper. Instructions on the github page
https://github.com/L0CKnL0aD7/template-theosXcodeWrapper
https://github.com/LnL7/template-theosXcodeWrapper


==== 2. xcode project wrapper ====
==== 2. xcode project wrapper ====
xCode does not accept .xm or .xmi files and does not complete code or highlight them. xCode also does not accept symlinks. This means the actual files containing code have to be .mm. To make theos work with them, just create a symlink with the .xm or xmi filename and point theos' makefile to it.
Xcode does not accept .xm or .xmi files and does not complete code or highlight them. Xcode also does not accept symlinks. This means the actual files containing code have to be .mm. To make theos work with them, just create a symlink with the .xm or xmi filename and point theos' makefile to it.
 


==== 3. Work around logos % directives breaking code completion ====
==== 3. Work around logos % directives breaking code completion ====
Unfortunately just using the %hook and adding methods in that block confuses xcode and it does not highlight and code complete stuff.
Unfortunately just using the %hook and adding methods in that block confuses xcode and it does not highlight and code complete stuff.
My solution for that problem is simply making xcode thing that the hooked methods are in an @implementation block.
My solution for that problem is simply making xcode think that the hooked methods are in an @implementation block.
My first attempt at that was something like:
My first attempt at that was something like:


Line 35: Line 33:
@implementation UIApplication
@implementation UIApplication
#endif
#endif


- (void) openURL: (id) arg {
- (void) openURL: (id) arg {
   
%orig;
%orig;
}
}


#ifdef THEOS
#ifdef THEOS
Line 58: Line 52:


This works, but it is ugly and just confused me while scrolling through the code.
This works, but it is ugly and just confused me while scrolling through the code.
=== sticktron's method ===
Xcode doesn't recognize the '''.x''' and '''.xm''' file extensions used by Logos, and therefore doesn't know how to apply syntax highlighting.<br>
Adding support for a custom filetype in OS X is a bizarrely difficult process whereby you have to launch an application containing the new UTI registration information.<br>
<br>
Here is a simple application that registers .x and .xm files, available on GitHub:<br>
Download [http://github.com/Sticktron/RegisterUTIsForLogos Source]<br>
Download [http://github.com/Sticktron/RegisterUTIsForLogos/raw/master/Binaries/RegisterUTIsForLogosApp.zip Binary]<br>
<br>
''Instructions:''<br>
Run the application, quit, and the new UTI will be registered system-wide.<br>
Restart Xcode (or any other app) for it to recognize the new UTI.<br>
Feel free to edit the Info.plist inside the app to add new UTIs for other filetypes you may need registered.
<br>

Latest revision as of 16:45, 31 December 2015

Using Logos and theos with Xcode

Theos and Logos were designed to allow developers to do iOS development without Xcode, but many developers instead prefer to use Xcode because of its code highlighting and code completion functionality. This page contains methods to integrate Xcode with Theos.


crash-x's method

I am sure many people have or will figure out better ways on how to do this, but for now I just want to get this started. What I am posting is far from perfect, but is useable and I am sure it will be useful to some. I am using xCode just as a code editor and let theos handle everything else.
The basic steps are:
1. Use an Xcode project as a wrapper.
2. Logos .xm files have to be .mm files with .xmi symlinks.
3. Work around logos % directives breaking code completion.

1. xcode project wrapper

I am simply using LnL7's wrapper. Instructions on the github page https://github.com/LnL7/template-theosXcodeWrapper

2. xcode project wrapper

Xcode does not accept .xm or .xmi files and does not complete code or highlight them. Xcode also does not accept symlinks. This means the actual files containing code have to be .mm. To make theos work with them, just create a symlink with the .xm or xmi filename and point theos' makefile to it.

3. Work around logos % directives breaking code completion

Unfortunately just using the %hook and adding methods in that block confuses xcode and it does not highlight and code complete stuff. My solution for that problem is simply making xcode think that the hooked methods are in an @implementation block. My first attempt at that was something like:

#ifdef THEOS
%group MyHooks
%hook UIApplication
#else
@implementation UIApplication
#endif

- (void) openURL: (id) arg {
	%orig;	
}

#ifdef THEOS
%end
%end
#else
@end
#endif

Add to your makefile:

MyTweak_CFLAGS = -DTHEOS

This works, but it is ugly and just confused me while scrolling through the code.

sticktron's method

Xcode doesn't recognize the .x and .xm file extensions used by Logos, and therefore doesn't know how to apply syntax highlighting.
Adding support for a custom filetype in OS X is a bizarrely difficult process whereby you have to launch an application containing the new UTI registration information.

Here is a simple application that registers .x and .xm files, available on GitHub:
Download Source
Download Binary

Instructions:
Run the application, quit, and the new UTI will be registered system-wide.
Restart Xcode (or any other app) for it to recognize the new UTI.
Feel free to edit the Info.plist inside the app to add new UTIs for other filetypes you may need registered.