All Projects → appsquickly → Xcodeeditor

appsquickly / Xcodeeditor

Licence: apache-2.0
An API for manipulating Xcode project files.

Labels

Projects that are alternatives of or similar to Xcodeeditor

Tulsi
An Xcode Project Generator For Bazel
Stars: ✭ 365 (-57.11%)
Mutual labels:  xcode, ide
Xcode One Dark
Atom One Dark theme for Xcode
Stars: ✭ 273 (-67.92%)
Mutual labels:  xcode, ide
Liko 12
LIKO-12 is an open source fantasy computer made using LÖVE.
Stars: ✭ 811 (-4.7%)
Mutual labels:  ide
Arduino Pro Ide
The Arduino IDE for advanced users and developers. Experimental alpha version.
Stars: ✭ 917 (+7.76%)
Mutual labels:  ide
Jucipp
A lightweight & cross-platform IDE supporting the most recent C++ standards. This project has moved to https://gitlab.com/cppit/jucipp.
Stars: ✭ 887 (+4.23%)
Mutual labels:  ide
Import
Xcode extension for adding imports from anywhere in the code ☝️
Stars: ✭ 818 (-3.88%)
Mutual labels:  xcode
Vst24 Hello World
This project contains a "Hello World" style application for building a VST 2.4 plugin
Stars: ✭ 18 (-97.88%)
Mutual labels:  xcode
Parallaxheader
Simple way to add parallax header to UIScrollView/UITableView written in Swift.
Stars: ✭ 808 (-5.05%)
Mutual labels:  xcode
Apprepositorytemplate
The easiest way to start a new application project without any manual configuration
Stars: ✭ 24 (-97.18%)
Mutual labels:  xcode
Hero Example
Learn how to use Hero transitions library.
Stars: ✭ 16 (-98.12%)
Mutual labels:  xcode
Xcode Complete Guide
Productivity guide for Xcode.
Stars: ✭ 19 (-97.77%)
Mutual labels:  xcode
Goclipse
Eclipse IDE for the Go programming language:
Stars: ✭ 832 (-2.23%)
Mutual labels:  ide
Xcodecoverage
Code coverage for Xcode projects (Objective-C only)
Stars: ✭ 818 (-3.88%)
Mutual labels:  xcode
Swiftui Animation Library
SwiftUI Animation Library. Useful SwiftUI animations including Loading/progress, Looping, On-off, Enter, Exit, Fade, Spin and Background animations that you can directly implement in your next iOS application or project. The library also contains huge examples of spring animations such as Inertial Bounce, Shake, Twirl, Jelly, Jiggle, Rubber Band, Kitchen Sink and Wobble effects. Browse, find and download the animation that fits your needs.
Stars: ✭ 898 (+5.52%)
Mutual labels:  xcode
Savannakit
A high-performance, protocol oriented, framework for creating native IDEs for iOS and macOS, written in Swift
Stars: ✭ 816 (-4.11%)
Mutual labels:  ide
Swipeabletabbarcontroller
UITabBarController with swipe interaction between its tabs.
Stars: ✭ 919 (+7.99%)
Mutual labels:  xcode
Bfkit
BFKit is a collection of useful classes and categories to develop Apps faster.
Stars: ✭ 811 (-4.7%)
Mutual labels:  xcode
Julia Vscode
Julia extension for Visual Studio Code
Stars: ✭ 823 (-3.29%)
Mutual labels:  ide
Donut
Xcode file template manager
Stars: ✭ 17 (-98%)
Mutual labels:  xcode
Vscode Sml
Standard ML support for Visual Studio Code
Stars: ✭ 26 (-96.94%)
Mutual labels:  ide

Description

An API for manipulating Xcode project files.

Usage

Adding Source Files to a Project

XCProject* project = [[XCProject alloc] initWithFilePath:@"MyProject.xcodeproj"];
XCGroup* group = [project groupWithPathFromRoot:@"Main"];
XCClassDefinition* classDefinition = [[XCClassDefinition alloc] initWithName:@"MyNewClass"];
[classDefinition setHeader:@"<some-header-text>"];
[classDefinition setSource:@"<some-impl-text>"];

[group addClass:classDefinition];
[project save];

Duplicating Targets

It will be added to project as well.

XCTarget* target = [project targetWithName:@"SomeTarget"];
XCTarget* duplicated = [target duplicateWithTargetName:@"DuplicatedTarget" productName:@"NewProduct"];

Specifying Source File Belongs to Target

XCSourceFile* sourceFile = [project fileWithName:@"MyNewClass.m"];
XCTarget* examples = [project targetWithName:@"Examples"];
[examples addMember:sourceFile];
[project save];

Adding a Xib File

This time, we'll use a convenience method on XCGroup to specify the targets at the same time:

XCXibDefinition* xibDefinition = [[XCXibDefinition alloc] initWithName:@"MyXibFile" content:@"<xibXml>"];
[group addXib:xibDefinition toTargets:[project targets]];
[project save];

Adding a Framework

XCFrameworkDefinition* frameworkDefinition =
    [[XCFrameworkDefinition alloc] initWithFilePath:@"<framework path>" copyToDestination:NO];
[group addFramework:frameworkDefinition toTargets:[project targets]];
[project save];

Setting copyToDestination to YES, will cause the framework to be first copied to the group's directory within the project, and subsequently linked from there.

Adding an Image Resource


XCSourceFileDefinition* sourceFileDefinition = [[XCSourceFileDefinition alloc]
    initWithName:@"MyImageFile.png" data:[NSData dataWithContentsOfFile:<your image file name>]
    type:ImageResourcePNG];

[group addSourceFile:sourceFileDefinition];
[project save];

Adding Asset Catalog (ImageSet)


XCSourceFileDefinition* sourceFileDefinition = [XCSourceFileDefinition sourceDefinitionWithAssetCatalogName:<path to asset catalog>];

[group addSourceFile:sourceFileDefinition];
[project save];

Adding a Header

XCSourceFileDefinition* header = [[XCSourceFileDefinition alloc]
    initWithName:@"SomeHeader.h" text:<your header text> type:SourceCodeHeader];

[group addSourceFile:header];
[project save];

Adding a sub-project

subProjectDefinition = [XCSubProjectDefinition withName:@"mySubproject" [email protected]"/Path/To/Subproject" type:XcodeProject];
[group addSubProject:subProjectDefinition toTargets:[project targets]];

Removing a sub-project

[group removeSubProject:subProjectDefinition];  //TODO: project should be able to remove itself from parent.

Configuring targets

We can add/update linker flags, header search paths, C-flags, etc to a target. Here we'll add header search paths:

XCTarget* target = [_project targetWithName:_projectName];
for (NSString* configName in [target configurations])
{
    XCBuildConfiguration* configuration = [target configurationWithName:configName];
    NSMutableArray* headerPaths = [[NSMutableArray alloc] init];
    [headerPaths addObject:@"$(inherited)"];
    [headerPaths addObject:@"$(SRCROOT)/include"];        
    [configuration addOrReplaceSetting:headerPaths forKey:@"HEADER_SEARCH_PATHS"];
}

. . . these settings are added by key, as they would appear in a make file. (Xcode provides more human friendly descriptions). To find the key for a given build setting, consult the compiler docs. Common settings are:

  • HEADER_SEARCH_PATHS
  • OTHER_LD_FLAGS
  • CLANG_CXX_LANGUAGE_STANDARD
  • CODE_SIGN_IDENTITY
  • GCC_C_LANGUAGE_STANDARD
  • INFOPLIST_FILE
  • LIBRARY_SEARCH_PATHS
  • PRODUCT_NAME
  • PROVISIONING_PROFILE

###Adding a Library

XCSourceFile * libSourceFile = [project fileWithName:@"libAmazing.a"];

XCTarget* target = [project targetWithName:self.mProject.projectName];
[target addMember:libSourceFile];

for (NSString* configName in [target configurations]) {
    XCProjectBuildConfig* configuration = [target configurationWithName:configName];
    NSMutableArray* headerPaths = [[NSMutableArray alloc] init];
    [headerPaths addObject:@"$(inherited)"];
    [headerPaths addObject:@"$(PROJECT_DIR)/Amazing"];
    [configuration addOrReplaceSetting:headerPaths forKey:@"LIBRARY_SEARCH_PATHS"];
}

File write behavior

//Creates the reference in the project and writes the contents to disk. If a file already exists at the 
//specified location, its contents will be updated.
[definition setFileOperationStyle:FileOperationStyleOverwrite]; 
//Creates the reference in the project. If a file already exists at the specified location, the contents will 
//not be updated.
[definition setFileOperationStyle:FileOperationStyleAcceptExisting]; 
//Creates the reference in the project, but does not write to disk. The filesystem is expected to be updated 
//through some other means.
[definition setFileOperationStyle:FileOperationStyleReferenceOnly]; 

Building

Open the project in XCode and choose Product/Build. Alternatively install with CocoaPods.

Feature Requests and Contributions

. . . are very welcome.

If you're using the API shoot me an email and tell me what you're doing with it.

Compatibility

  • Xcode-editor has been tested on Xcode 4+. It should also work on earlier versions of Xcode.
  • The AppCode IDE from JetBrains is now supported too!
  • Supports both ARC and MRR modes of memory management.

Who's using it?

  • Apportable : Develop Android applications using Xcode, Objective-C and Cocoa APIs
  • Xamarin: The Calabash automated functional testing for mobile applications.
  • Peckham : A great plugin for managing Xcode imports
  • Level Helper: A RAD framework for developing 2D games on iOS & Android.
  • Text Mate: The missing Text Editor for OSX.

Authors

With contributions from:

  • Connor Duggan - lots of bug fixes, maintenance and enhancements.
  • Alexander Smirnov - Cleaned up, generalized and contributed back the changes from the Calabash fork.
  • Zach Drayer - lots of fixes and features to support TextMate.
  • Janine Ohmer - support adding and removing sub-projects (http://www.synapticats.com).
  • Bogdan Vladu - support adding and removing groups (www.levelhelper.org).
  • Chris Ross of Hidden Memory (http://www.hiddenmemory.co.uk/)
  • Paul Taykalo
  • Vladislav Alekseev
  • Felix Schneider - bug fixes.
  • Isak Sky - mutable XCSourceFiles.
  • Derk-Jan Hartman : Adding folder references, by-file compiler flags.
  • StoneSpb : Speed improvements
  • Ce Zheng : Fixes relating to Xcode 7, xcconfig support and others.

Thanks!

LICENSE

Apache License, Version 2.0, January 2004, http://www.apache.org/licenses/

  • © 2011 - 2012 Jasper Blues and contributors.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].