Preventing merge conflicts with XcodeGen for your xcode project using xcodeGen and project.yml file

  • xcodeGen
  • .gitignore
  • xcconfig-extractor
  • project.yml

Install xcodeGen

Create .gitignore file

# Created by https://www.gitignore.io/api/xcode
# Edit at https://www.gitignore.io/?templates=xcode
### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## User settings
xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
## Xcode Patch
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
### Xcode Patch ###
**/xcshareddata/WorkspaceSettings.xcsettings
# End of https://www.gitignore.io/api/xcode

Install xcconfig-extractor

bash <(curl -sL https://raw.githubusercontent.com/toshi0383/scripts/master/swiftpm/install.sh) toshi0383/xcconfig-extractor// check version
xcconfig-extractor --version
xcconfig-extractor <project_name>.xcodeproj configurations
git rm -r --cached <filename># example
git rm -r --cached XcodeGenProject.xcodeproj/*
# for pod file
git rm -r --cached XcodeGenProject.xcworkspace/*

Create project.yml file

name: <project name> 
fileGroups:
- configs
configFiles:
Debug: configurations/Debug.xcconfig
Release: configurations/Release.xcconfig
targets:
<project name>:
type: application
platform: iOS
sources: <project name>
configFiles:
Debug: configurations/<project name>-Debug.xcconfig
Release: configurations/<project name>-Release.xcconfig settings:
CURRENT_PROJECT_VERSION: 1
scheme:
testTargets:
- <project name>Tests
- <project name>UITests
<project name>Tests:
type: bundle.unit-test
platform: iOS
sources: <project name>Tests
configFiles:
Debug: configurations/<project name>Tests-Debug.xcconfig
Release: configurations/<project name>Tests-Release.xcconfig dependencies:
- target: <project name>
<project name>UITests:
type: bundle.ui-testing
platform: iOS
sources: <project name>UITests
configFiles:
Debug: configurations/<project name>UITests-Debug.xcconfig
Release: configurations/<project name>UITests-Release.xcconfig
dependencies:
- target: <project name>

--

--

--

iOS Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Refactoring vs. Rewrite — Which is a Better Option ?

Beginners Guide for PHP

Create a Scrolling Background in Unity

Working with Terraform as a Team using terraform_remote_state

Spring Jdbc— KeyHolder to retrieve database auto-generated keys

Cloud-Native vs Cloud-Enabled? Why Cloud-Native Applications are the Future?

How did I get the California Real ID in the Bay Area: Part II

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ODENZA

ODENZA

iOS Developer

More from Medium

Higher order functions in Swift

Provide type safe NSCopying/NSMutableCopying API with Swift Generics?

Add activity indicator to the top of UITableView

Combining Operators In RxSwift