[OBJC]Tags; OR Say Hello to SYNTAX HIGHLIGHTING!

Discussion in 'iOS Development' started by SkylarEC, Jul 14, 2009.

  1. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Bgizzle and I are proud to announce the arrival of [OBJC] tags. Use these in place of
    Code:
     tags.
    
    What's new?  Well, syntax highlighting, for one.  Obviously we can not and will not parse through for variables, but the rest should light up in the correct default Xcode colors.  
    
    [B]We are the FIRST iPhone/iPod forum to have correct iPhone specific Objective-C 2.0 syntax highlighting.[/B]
    
    For example:
    [OBJC]//
    //  PTStatusBar.h
    //  PocketTouch
    //
    //  Created by Skylar Cantu on 7/14/09.
    //  Copyright 2009 Skylar Cantu. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    #import "PocketTouch.h"
    
    @protocol PTStatusBarDelegate;
    
    @interface PTStatusBar : PTGlossyView  {
        id<PTStatusBarDelegate> delegate;
    }
    
    @property (nonatomic, assign) id<PTStatusBarDelegate> delegate;
    
    @end
    
    @protocol PTStatusBarDelegate <NSObject>
    @optional
    - (void)statusBarTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
    - (void)statusBarTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
    - (void)statusBarTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
    - (void)statusBarTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
    @end[/OBJC]
    
    Pretty, isn't it.     : )
    
    To use simple replace all [CODE] with [OBJC].  Don't forget to also change the closing tags to /OBJC.
    
    
    
    
    Now, here's where you come in.  I know we have missed some things, such as assign, copy, retain, and nonatomic.  They are next on the list to be added to the coloring array.  If you can see anything we have missed, please post it as a result of this thread.  I am pretty sure I have UIKit covered.  
    
    Note, I haven't created a list of constants yet, as I don't have the time or patience to do that.  If you want to, feel free to.  You *will* be credited for it.
    
    
    
    EDIT: I have gone though the first page of the developers' and tutorials fora and replaced selected code samples with OBJC tags.  Take a look! : )
  2. willdacracka

    willdacracka Member

    Joined:
    Apr 21, 2008
    Messages:
    834
    Likes Received:
    0
    Device:
    iPhone
    I understood every bit of that.
  3. Shawa

    Shawa Super Moderator

    Joined:
    Jan 31, 2009
    Messages:
    3,188
    Likes Received:
    22
    Device:
    Nexus 4
    Nice. Are other languages going to be added?
  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    There's no plans to. Objective-C naturally covers C, so I guess there's two languages covered (and yes, there is quite a bit of C included).

    Aside from that, your average user doesn't really use any other languages to code on the iPhone/iPod touch.
  5. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
  6. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    Much better, looks nicer, easier to understand.
  7. bddckr

    bddckr Active Member

    Joined:
    Dec 2, 2007
    Messages:
    1,434
    Likes Received:
    18
    Device:
    iPhone 4 (Black)
    Awesome.
    Now we just need another button in the text editor on the site...
  8. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    I noticed that @optional for the protocol isn't the right color.
  9. NolesFans

    NolesFans New Member

    Joined:
    Sep 23, 2008
    Messages:
    404
    Likes Received:
    0
    Device:
    iPod touch
    nonatomic and assign/assign/copy are should be pink too.
  10. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    They are on the list. Right now, it is up to Bgizzle to add them.

    Good catch. I could have sworn that @optional and @required were already both colored. Thank you.

Share This Page