{"id":13611100,"url":"https://github.com/appsquickly/XcodeEditor","last_synced_at":"2025-04-13T01:34:39.683Z","repository":{"id":43204989,"uuid":"3134742","full_name":"appsquickly/XcodeEditor","owner":"appsquickly","description":"An API for manipulating Xcode project files.","archived":false,"fork":false,"pushed_at":"2022-03-15T10:43:24.000Z","size":9613,"stargazers_count":880,"open_issues_count":28,"forks_count":135,"subscribers_count":45,"default_branch":"master","last_synced_at":"2024-10-30T17:13:27.136Z","etag":null,"topics":["ide","objective-c","xcode"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appsquickly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-09T07:27:27.000Z","updated_at":"2024-10-22T12:55:21.000Z","dependencies_parsed_at":"2022-08-20T23:30:40.358Z","dependency_job_id":null,"html_url":"https://github.com/appsquickly/XcodeEditor","commit_stats":null,"previous_names":["jasperblues/xcodeeditor"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FXcodeEditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FXcodeEditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FXcodeEditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FXcodeEditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appsquickly","download_url":"https://codeload.github.com/appsquickly/XcodeEditor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223558555,"owners_count":17165143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ide","objective-c","xcode"],"created_at":"2024-08-01T19:01:51.786Z","updated_at":"2024-11-07T17:31:22.229Z","avatar_url":"https://github.com/appsquickly.png","language":"Objective-C","funding_links":[],"categories":["Objective-C"],"sub_categories":[],"readme":"# Description\n\nAn API for manipulating Xcode project files. \n\n# Usage\n\n### Adding Source Files to a Project\n\n\n```objective-c\nXCProject* project = [[XCProject alloc] initWithFilePath:@\"MyProject.xcodeproj\"];\nXCGroup* group = [project groupWithPathFromRoot:@\"Main\"];\nXCClassDefinition* classDefinition = [[XCClassDefinition alloc] initWithName:@\"MyNewClass\"];\n[classDefinition setHeader:@\"\u003csome-header-text\u003e\"];\n[classDefinition setSource:@\"\u003csome-impl-text\u003e\"];\n\n[group addClass:classDefinition];\n[project save];\n```\n\n### Duplicating Targets\n\nIt will be added to project as well.\n\n```objective-c\nXCTarget* target = [project targetWithName:@\"SomeTarget\"];\nXCTarget* duplicated = [target duplicateWithTargetName:@\"DuplicatedTarget\" productName:@\"NewProduct\"];\n```\n\n\n### Specifying Source File Belongs to Target\n\n```objective-c\nXCSourceFile* sourceFile = [project fileWithName:@\"MyNewClass.m\"];\nXCTarget* examples = [project targetWithName:@\"Examples\"];\n[examples addMember:sourceFile];\n[project save];\n```\n\n\n### Adding a Xib File\n\nThis time, we'll use a convenience method on XCGroup to specify the targets at the same time:\n\n```objective-c\nXCXibDefinition* xibDefinition = [[XCXibDefinition alloc] initWithName:@\"MyXibFile\" content:@\"\u003cxibXml\u003e\"];\n[group addXib:xibDefinition toTargets:[project targets]];\n[project save];\n```\n\n\n### Adding a Framework\n\n```objective-c\nXCFrameworkDefinition* frameworkDefinition =\n    [[XCFrameworkDefinition alloc] initWithFilePath:@\"\u003cframework path\u003e\" copyToDestination:NO];\n[group addFramework:frameworkDefinition toTargets:[project targets]];\n[project save];\n```\nSetting copyToDestination to YES, will cause the framework to be first copied to the group's directory within the\nproject, and subsequently linked from there. \n\n### Adding an Image Resource\n\n```objective-c\n\nXCSourceFileDefinition* sourceFileDefinition = [[XCSourceFileDefinition alloc]\n    initWithName:@\"MyImageFile.png\" data:[NSData dataWithContentsOfFile:\u003cyour image file name\u003e]\n    type:ImageResourcePNG];\n\n[group addSourceFile:sourceFileDefinition];\n[project save];\n```\n\n### Adding Asset Catalog (ImageSet)\n\n```objective-c\n\nXCSourceFileDefinition* sourceFileDefinition = [XCSourceFileDefinition sourceDefinitionWithAssetCatalogName:\u003cpath to asset catalog\u003e];\n\n[group addSourceFile:sourceFileDefinition];\n[project save];\n```\n\n### Adding a Header\n\n```objective-c\nXCSourceFileDefinition* header = [[XCSourceFileDefinition alloc]\n    initWithName:@\"SomeHeader.h\" text:\u003cyour header text\u003e type:SourceCodeHeader];\n\n[group addSourceFile:header];\n[project save];\n```\n\n### Adding a sub-project\n\n```objective-c\nsubProjectDefinition = [XCSubProjectDefinition withName:@\"mySubproject\" projPath=@\"/Path/To/Subproject\" type:XcodeProject];\n[group addSubProject:subProjectDefinition toTargets:[project targets]];\n```\n\n### Removing a sub-project\n```objective-c\n[group removeSubProject:subProjectDefinition];  //TODO: project should be able to remove itself from parent.\n```\n\n### Configuring targets\n\nWe can add/update linker flags, header search paths, C-flags, etc to a target.  Here we'll add header search paths: \n\n```objective-c\nXCTarget* target = [_project targetWithName:_projectName];\nfor (NSString* configName in [target configurations])\n{\n    XCBuildConfiguration* configuration = [target configurationWithName:configName];\n    NSMutableArray* headerPaths = [[NSMutableArray alloc] init];\n    [headerPaths addObject:@\"$(inherited)\"];\n    [headerPaths addObject:@\"$(SRCROOT)/include\"];        \n    [configuration addOrReplaceSetting:headerPaths forKey:@\"HEADER_SEARCH_PATHS\"];\n}\n```\n\n. . . 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: \n\n* HEADER_SEARCH_PATHS\n* OTHER_LD_FLAGS\n* CLANG_CXX_LANGUAGE_STANDARD\n* CODE_SIGN_IDENTITY\n* GCC_C_LANGUAGE_STANDARD\n* INFOPLIST_FILE \n* LIBRARY_SEARCH_PATHS\n* PRODUCT_NAME\n* PROVISIONING_PROFILE\n\n###Adding a Library\n\n```objc\nXCSourceFile * libSourceFile = [project fileWithName:@\"libAmazing.a\"];\n\nXCTarget* target = [project targetWithName:self.mProject.projectName];\n[target addMember:libSourceFile];\n\nfor (NSString* configName in [target configurations]) {\n    XCProjectBuildConfig* configuration = [target configurationWithName:configName];\n    NSMutableArray* headerPaths = [[NSMutableArray alloc] init];\n    [headerPaths addObject:@\"$(inherited)\"];\n    [headerPaths addObject:@\"$(PROJECT_DIR)/Amazing\"];\n    [configuration addOrReplaceSetting:headerPaths forKey:@\"LIBRARY_SEARCH_PATHS\"];\n}\n```\n\n### File write behavior\n\n```objective-c\n//Creates the reference in the project and writes the contents to disk. If a file already exists at the \n//specified location, its contents will be updated.\n[definition setFileOperationStyle:FileOperationStyleOverwrite]; \n```\n\n```objective-c\n//Creates the reference in the project. If a file already exists at the specified location, the contents will \n//not be updated.\n[definition setFileOperationStyle:FileOperationStyleAcceptExisting]; \n```\n\n    \n```objective-c\n//Creates the reference in the project, but does not write to disk. The filesystem is expected to be updated \n//through some other means.\n[definition setFileOperationStyle:FileOperationStyleReferenceOnly]; \n```\n\n\n# Building \n\nOpen the project in XCode and choose Product/Build. Alternatively install with CocoaPods. \n\n# Feature Requests and Contributions\n\n. . . are very welcome. \n\nIf you're using the API shoot me an email and tell me what you're doing with it. \n\n# Compatibility \n\n* Xcode-editor has been tested on Xcode 4+. It should also work on earlier versions of Xcode. \n* The AppCode IDE from JetBrains is now supported too! \n* Supports both ARC and MRR modes of memory management.\n\n# Who's using it? \n\n* \u003ca href=\"http://www.apportable.com\"\u003eApportable\u003c/a\u003e : Develop Android applications using Xcode, Objective-C and Cocoa APIs\n* \u003ca href=\"https://github.com/calabash/calabash-ios\"\u003eXamarin\u003c/a\u003e: The Calabash automated functional testing for mobile applications. \n* \u003ca href=\"https://github.com/markohlebar/Peckham\"\u003ePeckham\u003c/a\u003e : A great plugin for managing Xcode imports\n* \u003ca href=\"http://www.levelhelper.org\"\u003eLevel Helper\u003c/a\u003e: A RAD framework for developing 2D games on iOS \u0026 Android. \n* \u003ca href=\"http://macromates.com/\"\u003eText Mate\u003c/a\u003e: The missing Text Editor for OSX.\n\n\n\n# Authors\n\n* \u003ca href=\"http://ph.linkedin.com/pub/jasper-blues/8/163/778\"\u003eJasper Blues\u003c/a\u003e - \u003ca href=\"mailto:jasper@appsquick.ly?Subject=xcode-editor\"\u003ejasper@appsquick.ly\u003c/a\u003e\n         \n### With contributions from: \n\n* \u003ca href=\"https://github.com/cncool\"\u003eConnor Duggan\u003c/a\u003e - lots of bug fixes, maintenance and enhancements. \n* \u003ca href=\"https://github.com/smirn0v\"\u003eAlexander Smirnov\u003c/a\u003e - Cleaned up, generalized and contributed back the changes from the Calabash fork. \n* Zach Drayer - lots of fixes and features to support TextMate. \n* Janine Ohmer - support adding and removing sub-projects (http://www.synapticats.com).\n* Bogdan Vladu - support adding and removing groups (www.levelhelper.org).\n* Chris Ross of Hidden Memory (http://www.hiddenmemory.co.uk/)\n* Paul Taykalo\n* Vladislav Alekseev \n* Felix Schneider - bug fixes. \n* Isak Sky - mutable XCSourceFiles. \n* \u003ca href=\"https://github.com/hartman\"\u003eDerk-Jan Hartman\u003c/a\u003e : Adding folder references, by-file compiler flags. \n* \u003ca href=\"https://github.com/StoneSpb\"\u003eStoneSpb\u003c/a\u003e : Speed improvements\n* \u003ca href=\"https://github.com/cezheng\"\u003eCe Zheng\u003c/a\u003e : Fixes relating to Xcode 7, xcconfig support and others. \n\nThanks! \n\n# LICENSE\n\nApache License, Version 2.0, January 2004, http://www.apache.org/licenses/\n\n* © 2011 - 2012 Jasper Blues and contributors.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappsquickly%2FXcodeEditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappsquickly%2FXcodeEditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappsquickly%2FXcodeEditor/lists"}