I'm currently refactoring my Xcode project into a Swift Package with multiple modules, which I combine with a lightweight Xcode project using an XCWorkspace (kind of like Pointfree's isowords). Right now, my Xcode project is hosted on a GitHub repo. However, with this refactoring, it's the Swift Package which will be hosted on GitHub.
Can I replace my Xcode project with the Swift Package on the repo, without losing all my history? Will the history of files inside my Xcode project still show up?
Yes, this will be fine. Even if you delete every single file in your git repository and push it, your entire commit history will still be there. Feel free to replace your project with a package!
Related
I am working with an existing GitHub repository and I want to create a new Xcode project from it. How can this be done?
I have previously used Xcode just as a python script editor and never created a project, but I would like to do so in this case so that I can have a special indentation style just for the files in this project (this is Python, so no interest in build targets etc, just want to edit and use git).
I am using Xcode 6.0.1 on Mavericks.
IanAuld's answer sent me in the right direction and I figured out what I was doing wrong. I had been assuming that the Xcode project should be inside the directory with the git project, but that was causing problems because then git tries to track the Xcode project.
Here's what I am now doing, which seems to work:
Create a new Xcode project somewhere that is not managed by git. Make sure that "Create Git repository on ..." is not checked.
Clone the github project to a directory that does not include the Xcode project.
In Xcode, File | Add Files to "ProjectName"..., and select the folder with the git project.
Now, if I edit any of those files in the context of the project, it uses the indentation style I set for the project (though if I edit the file on its own it uses my global indentation style), and I can control git through the Source Control menu.
Problem solved.
I have an iOS project which uses a few CocoaPods that I have been regularly committing to a private GitHub repo. Because of the CocoaPods, I always launch it via its workspace.
For the first time ever I attempted to work on the project on a different computer. When I opened XCode and attempted to pull the repo, I realized that the workspace is not in the repo. Only the project itself is there.
Does that mean I did something wrong when I initially created the project repository or does it mean that you simply cannot use multiple computers with GitHub to work on a project that requires CocoaPods?
Just run pod install on the other computer and it will download the dependencies from your Podfile.lock (or Podfile if no lock is present) and generate the workspace.
Another option is to add your Pods directory, along with your xcworkspace and Podfile.lock, to version control. That way your project will be always ready after cloning and your dependencies will be synced in your repository. If those items do not show up on Xcode's git interface, use the git from your Terminal or other app.
The use case you describe is quite common and works fine. You must have forgotten to add the workspace to the repo, maybe it’s in your .gitignores?
I've got an existing Swift project in Xcode and I want to use the functionality of this github project (MangoKitten)
They suggest using Swift Package Manager but when I tried setting up that my Xcode went haywire and would crash every time I tried launching it.
So I've finally managed to undo the damage done from SPM and am trying to just go ahead and add MangoKitten into my project manually so that I can use the functionality it provides with a simple import statement in my viewController.swift
I've never used Github before and I'm relatively new to Swift in general so this is all very confusing.
Is there any simple way to import the github project into my Xcode project without downloading it and adding every single .swift file manually into my project?
Thanks guys.
It's clear how to add an existing project to GitHub outside of Xcode, there are a number of tutorial: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
There are also a number of tutorial of how to create a new project in Xcode under version control.
However, there are no tutorial on how to do both: add an existing project with the controls within Xcode. Is this even possible? Or since I already started the project, I'll have to do it all via command line?
Since you didn't ask Xcode for a local git repository inside this project folder when you created the project, you will have to create one via the command line.
After that, you can use Xcode's internal GUI to give git commands in your project - if that's the kind of thing you really want to do (personally I abhor Xcode's git interface).
I'm new to iOS developing, I haven't used earlier versions of XCode.
Yet I have stored my project on my local hd. Now I want to use some online subversion service.
I cannot seem to find the appropriate options in XCode. The hints that I googled all refer to a menu called SCM which I don't seem to have.
I created a new and empty repository online (webbased) and tried to configure XCode to use it by selecting the "Connect to a repository" menu when xcode starts. After some tweeking in the command line this "connect to a repository" succeeded but afterwards XCode simply closed itself again.
I tried copying the files that belong to my project to the path that I set up to be used with SVN manually. I opened the project in XCode from that path and after adding another file wanted to commit that change but couldn't find how to do that from within XCode.
Now I found that in XCode / Organizer / Repositories / MyProject is listed but has the type "GIT", which is wrong.
Do I have to change the repository type to SVN instead of GIT? If so, how can I?
When you created the project there was an option to put the project under source control. This option creates a git repository and is checked by default.
To use SVN you have to import your project into the SVN repository. (And you probably don't want it to be under git and svn at the same time, so you'll either delete the .git folder or recreate your project without the scm option selected.) Once the project is imported into your repository then you make sure Xcode knows about the repository and you can check the project out.
But really I'd recommend just using Git. It's a modern version control system with lots of nice features (though to do much of anything out of the ordinary requires using the command line) and there are nice project hosting sites for it like GitHub. I don't think SVN compares very well to git.