Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/0x973/XcodeManager
A swift module to manipulate Xcode projects(project.pbxproj),written in swift
https://github.com/0x973/XcodeManager
pbxproj swift xcode
Last synced: 2 months ago
JSON representation
A swift module to manipulate Xcode projects(project.pbxproj),written in swift
- Host: GitHub
- URL: https://github.com/0x973/XcodeManager
- Owner: 0x973
- License: bsd-3-clause
- Created: 2018-04-17T08:41:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-22T04:01:31.000Z (over 2 years ago)
- Last Synced: 2024-07-30T21:05:20.528Z (5 months ago)
- Topics: pbxproj, swift, xcode
- Language: Swift
- Homepage:
- Size: 67.4 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XcodeManager
![Build Status](https://github.com/0x973/XcodeManager/actions/workflows/swift.yml/badge.svg?branch=master)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-00D835.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Platform](https://img.shields.io/badge/Platform-OSX-green.svg)](https://github.com/0x973/XcodeManager)The better way to manage the Xcode project file (project.pbxproj) in swift.
This swift module lets you automate the modification process.## Requirements
- macOS 10.12+
- Xcode 8+## Integration
#### Swift Package Manager
```swift
.package(url: "https://github.com/0x973/XcodeManager.git", from: "0.2.0")
```#### Carthage
You can use [Carthage](https://github.com/Carthage/Carthage) to install `XcodeManager` by adding it to your Cartfile:
```
github "0x973/XcodeManager" ~> 0.2.0
```## Usage
0. import module.```swift
import XcodeManager
```1. Initialize the Xcode project file.
```swift
var project = try? XcodeManager(projectFile: "../.../xxx.xcodeproj", printLog: true)
```2. How to add static library in Xcode project?
```swift
project.linkStaticLibrary("../.../test.a")
```3. How to add framework in Xcode project?
```swift
project.linkFramework("../.../test.framework")
```4. How to add resources folder in Xcode project?
```swift
project.addFolder("../.../test/")
```5. How to add a single resources file in Xcode project?
```swift
project.addFile("../.../test.txt")
```6. How to modify the product name (display name)?
```swift
project.setProductName("TestProduct")
```7. How to modify the Bundle Identifier?
```swift
project.setBundleId("cn.x0x01.TestProduct")
```8. How to add new value?
```swift
project.setLibrarySearchPathValue("$(PROJECT_DIR)/TestProduct/Folder")
```9. How to add new value?
```swift
project.setFrameworkSearchPathValue("$(PROJECT_DIR)/TestProduct/Folder")
```10. How to control the CodeSignStyle(manual OR automatic)?
```swift
project.setCodeSignStyle(type: .automatic)
project.setCodeSignStyle(type: .manual)
```11. Complete modification? Write to a .pbxproj file!
```swift
let isSaveSuccess = try? project.save()
if (isSaveSuccess) {
print("Done!")
}
```