How do I create a category in Xcode 6 or higher?

后端 未结 8 1805
太阳男子
太阳男子 2020-11-27 09:53

I want to create a category on UIColor in my app using Xcode 6. But the thing is that in Xcode 6 there is no Objective-C category file template.

Is the

8条回答
  •  春和景丽
    2020-11-27 10:03

    You can create "extension" file like NSString+Helper:

    1: File → New → File... or use ⌘N.
    
    2: Name NSString+Helper (For example)
    
    3: create the file
    
    4: Remove the code from file
    
    5: add 
    
    extension NSString {
    
    
    }
    

    Done. enjoy coding

提交回复
热议问题