Swiftpack.co - bannzai/XcodeProject as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by bannzai.
bannzai/XcodeProject v0.1.1
Xcode utility for reading and writing pbxproj file format.
⭐️ 61
🕓 3 years ago
.package(url: "https://github.com/bannzai/XcodeProject.git", from: "v0.1.1")

XcodeProject

XcodeProject is a library for Xcode utility for read structure and it can be overwrite for`project.pbxproj.
And XcodeProject package has executable library about append and remove files and directory to your xcode project on CLI named by xcp.

About XcodeProject Library

Usage XcodeProject Core Function.

Instanciate XcodeProject class. XcodeProject is necessary edit for project.pbxproj.

// Prepare for your project `project.pbxproj` file path.
let yourProjectPath = "/Users/bannzai/development/iOSProject/iOSProject.xcodeproj"
let pbxPath = yourProjectPath + "/project.pbxproj"
let xcodeprojectFileURL = URL(fileURLWithPath: pbxPath)

// Instanciate `XcodeProject`.
let xcodeproject = try XcodeProject(xcodeprojectURL: xcodeprojectFileURL)

Append file with relative wfile path from iOSProject.xcodeproject directory and build target name.

xcodeproject.appendFile(path: "iOSProject/Repository/UserRepository.swift", targetName: "iOSProject")

Remove file with relative wfile path from iOSProject.xcodeproject directory and build target name.

// append file with file path and build target name. 
xcodeproject.removeFile(path: "Config.swift", targetName: "iOSProject")

If you want overwrite project.pbxproj, You can call xcodeproject.write() method.

// Overwrite in pbxproj.
try xcodeproject.write()

Command Line Tool

Install

Using mint.

$ mint install bannzai/XcodeProject

Usage

Add file

xcp --add-file <FILE_PATH> <BUILD_TARGET_NAME>

$ xcp --add-file iOSProject/Group/A.swift iOSProject.xcodeproj/project.pbxproj iOSProject 

Add group

xcp --add-group <FILE_PATH> <BUILD_TARGET_NAME>

$ xcp --add-group iOSProject/Group/ iOSProject.xcodeproj/project.pbxproj iOSProject

Remove file

xcp --remove-file <FILE_PATH> <BUILD_TARGET_NAME>

$ xcp --remove-file iOSProject/Group/A.swift iOSProject.xcodeproj/project.pbxproj iOSProject 

Remove group

xcp --remove-group <FILE_PATH> <BUILD_TARGET_NAME>

$ xcp --remove-group iOSProject/Group/ iOSProject.xcodeproj/project.pbxproj iOSProject

Used in

Kuri

Kuri is code generate for iOS CleanArchitecture.

License

XcodeProject is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 61
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Support Swift Package Manager Dependency
3 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics