Right Click on YOUR_PROJECT_NAME.xcodeproj Show Package Contents then open project.pbxproj in text editor.
Do cmd + f and remove the following lines from the project.pbxproj file
minimizedProjectReferenceProxies = 1;
preferredProjectObjectVersion = 77;
Do cmd + f and replace all PBXFileSystemSynchronizedRootGroup to PBXGroup in project.pbxproj file.
Finally, find and update objectVersion = 77; to objectVersion = 56; in project.pbxprojfile and save it.
Now, close Xcode and run pod init. Your all swift files will be present in the project navigator and your PodFile will be created without any issue.