Michel Ortega
Michel Ortega

Reputation: 43

Git ignore file for Xcode projects is ignoring .swift files

Yesterday I added a git ignore file to my Xcode project and during version control is ignoring every .swift file I create so those are not appearing in my commits. Other member of my team are having problems with my changes because of this. They can side the file in the left side of Xcode but can not enter to it.

What should I’ve been looking for in the git ignore file ?

.gitignore:

Pods/ActionSheetPicker-3.0/LICENSE
...
...
...
Pods/Target Support Files/STPopup/STPopup.xcconfig
.DS_Store
**/.DS_Store
*/.DS_Store
## User settings
xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
codi-fix-demo.xcodeproj/xcuserdata/*
codi-fix-demo.xcodeproj/project.xcworkspace/xcuserdata/*

Upvotes: 0

Views: 962

Answers (1)

denis_lor
denis_lor

Reputation: 6547

1) Take a look at your .swift files through Finder if they are in the right directories/path folders/subfolders.

Then take a look on each of them, if they are greyed-out on the Project Navigator from Xcode or if they are red. In both case click on the file from the Project Navigator and from the Inspector (menu on the right) check Location and Full Path if they are correct, try to click on the icon circled in red in this screenshot and find where your swift file is and confirm it.

enter image description here

2) Your .gitignore looks fine in the sense that didn't affect your .swift files but you could improve it and reduce it to this:

Pods/
*.DS_Store
.build/
xcshareddata/
xcuserdata/
## Build generated
build/
DerivedData/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
codi-fix-demo.xcodeproj/xcuserdata/*
codi-fix-demo.xcodeproj/project.xcworkspace/xcuserdata/*

Upvotes: 3

Related Questions