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

How we built Reelo? A loyalty app that has over 2M customers

How we built Reelo? A loyalty app that has over 1M customers

what is atta exactly?

MYSQL Case-Sensitive Search

MV(F)C: Model-View-(Fat)Controller

From 40% to Passing:

Some Examples in SQL

My React JS journey

The Android Emulator and Charles Proxy: A Love Story

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

GCD: DispatchSource and Target Queue Hierarchy

iOS: MVVM design for Screen having multiple web services/multiple sources of data

Analyze iOS App Binary size with Link Map

Unit Testing -iOS Network Layer-Using Swift