Adding square SDK as dependency in Swift 4, Xcode 9 - square-connect

I am looking for help doing this step in Xcode 9, Swift 4:
Git Submodules
Checkout the submodule with git submodule add https://github.com/square/SquarePointOfSaleSDK-iOS.git, drag SquarePointOfSaleSDK.xcodeproj to your project, and add SquarePointOfSaleSDK as a build dependency.
I simply have no idea how to do this - and the examples I found have not worked.
Any help would be greatly appreciated as I am dead in the water.
Thanks, Craig

You need a git repo in order to run that command. By default, Xcode will create a git repo for you in your project, so you can simply open your terminal, navigate to your project directory and run:
git submodule add https://github.com/square/SquarePointOfSaleSDK-iOS.git
This will copy "SquarePointOfSaleSDK-iOS" to your directory. Then, in Finder, you can simply open "SquarePointOfSaleSDK-iOS", drag "SquarePointOfSaleSDK.xcodeproj" to above your project in Xcode. It will ask if you want to save as a Workspace, you should say yes. Then, in Xcode, click on the root of your project, and under "General" - "Linked Frameworks and Libraries", hit the "+" and choose "SquarePointOfSaleSDK.framework".
After that, go ahead and do a build to make sure everything is working, and then you should have access to the SDK within your project.

Related

How can I checkout github project on xCode 5 correctly?

How can I checkout github project on xCode 5 correctly?
I have done checkout from xCode (Source Control - Check Out...). But now I can't commit any changes to the repository (Source Control - Commit...). All "Source Control" commands are disabled on the xCode except "Check Out...". But ".git" folder presents on the project's folder. What's wrong with it?
You can follow this tutorial, which describes your case after having created locally a git repo and done some commits:
The git repository is ready, but if you go back to Xcode and open the Source Control menu, you’ll find out that everything is still disabled.
That’s because Xcode doesn’t get notified automatically about our manual git repository addition.
So, close Xcode using the menu Xcode > Quit Xcode and re-open it.
Now, in the NoGitExample project if you open the Source Control menu once again, you’ll see that all options have been enabled, just like if we would have added the git repository along with the project creation.

Xcode won't add files to source control

when ever i add files to my project. Xcode should automatically "at least it did at one point" add it to my source control. and write a A out for it.
now it just does this : see picture
i tried to reinstall Xcode using app-cleaner.. nothing changed there
And NO it doesn't help if i click the add files, no matter where in Xcode i click Add - nothing happens...
i'm using Github as repo
and using Xcode 5.1
i know i could just use Terminal and use git commands like : git add -A git commit -m "first init" and finally git push origin -u
but Xcode should do all this for me
If you click on 'Source Control' in the XCode menu do you see two options listed? I found that I had a .git file located in my iOS projects directory which contains all of my iOS projects. I deleted this and it fixed the problem.
I think that when you import all of your repos into SourceTree it creates a .git file in the parent folder of your repos.

Import project from git in xcode

I have a project under source control with at remote repository where I commit and push to.
Now I need to have another programmer work on the same project and therefore same Git repo.
I cannot figure out how one imports a project from an existing Git repo.
I have worked with Eclipse and Git where I have no problem doing this.
Any help is appreciated.
For xCode 6 and lower
In xCode go to Window >> Organiser
Then select repositories
Click the + button and select Checkout or Clone repository
Then enter the details for your GIT
For xCode7 and above
Go to Window >> Welcome to xCode
Click on the Check out an existing project button on the left hand side.
Then enter the details for the repository you want to access.
For Xcode 9.4 and Git repository without *.xproj file simple Source Control -> Clone... method doesn't work. Xcode just clones remote repository and opens it in Finder - no project is created nor opened.
Here is what worked for my remote C++ repository:
$ git clone [your_repo.git]
Create new project Shift + CMD + N
Enable version control
Now you should have cloned repo and new Xcode repo:
In your new Xcode repo remove all except *.xcodeproj
In Xcode remove default Groups and Files (except Products):
Copy cloned repo content into new Xcode project directory:
$ ditto [cloned_repo/] [new_repo/].
Check that .git directory was copied successfully.
Add dirs and files into the project. Drag'n'drop them from Finder to your new Xcode project. Don't drag .git and *.xcodeproj.
Check branches and commit history:
Since the answers are old, now there's an easier way to directly import/clone project into Xcode from Github and Bitbucket.
Bitbucket: Press Clone in Xcode button
Github: Press Open in Xcode button
It seems that now (Version 12.0.1) there is no "officially supported" way to work with source control at Xcode with repository without *.xcodeproj file

Can't add xCode 4.2 project to repository (and get it working)

I created a new project and all files are added to the projectfile.
I 'cd' to my project root and does the following steps:
rm -rf .git (remove all left overs if any).
git init
git add .
git -m "initial commit"
Then I load my project, and make some changes to my code. xCode 4.2 notifies this correctly by adding the 'm' (modified) icon in the project explorer.
I right click the modified file and choose "Source control->Commit selected files" and it says: The working copy "of my project" could not be found. Please verify that the working copy is reachable and try again.
The entry I just created is red in Organizer, any ideas whats wrong? Have I missed a step?
I suggest using built-in GIT support inside xCode, not a command line git.
On project creation page, where you select folder to store project, there is checkbox you mark if you want to use GIT.
All other GIT stuff are accessible view File->Source Control menu.
So, try re-creating your project but make sure you've selected GIT support.

Using Git with an existing Xcode project

I am trying to figure out how to use git in my project workflow, and I have an existing Xcode project that I want to put into the repository. I think I have the repository set up correctly under organizer, but the Source Control menu is grayed out.
Apparently, it's easy to do if you start a new project, but how do I import an existing project with snapshots and everything?
I'm using Xcode 4 and git 1.7.4
Also, if there are any good walkthroughs on git configuration and best practices, that would be nice. I'm a little late to the game, so anything that can get me up to speed would be cool.
GitHub has some very good git tutorials at help.github.com.
to do the initial setup of a repository, open up a terminal window, and CD to the project directory. once there, type
git init
git add .
git commit -m "Initial commit"
Restart Xcode.
The repository should now be set up, and you will be able to manage it in xcode 4.
Xcode 7 (and 8)
If you were starting a new project you would just check Create Git repository during the setup. (Then skip down to the Commit part below.)
But it you are working with an existing project, go to Xcode > Preferences... > Source Control and check the Enable Source Control box.
Then in the main Source Control menu choose Create Working Copy....
(If you get a "Please tell me who you are" error the see this question/answer or one of the other linked questions there.)
When that has finished, make any change to one of your Xcode project files. Then go back to the Source Control menu and choose Commit.
And write a commit message and click the Commit button. (If the commit button is disabled, then make any minor change to your project and try again.)
In Github sign in and create a new repository.
Call it whatever you want, but don't add a README or .gitignore or license yet. You can add those things later. Doing so now will make the syncing more difficult.
Copy the link to your repository.
Go to Source Control > your branch name > Configure.
Click the Remotes tab > "+" button > Add remote....
Enter the github repository name and paste in the address.
After adding the remote, click Push in the Source Control menu. Enter your github user name and password. That's it. You project should be copied to github now.
(I had some trouble getting my username and password accepted at first. If that happens to you go to Xcode > Preferences... > Accounts > your new repository. Enter your user name and password there and then try the Push again.)
You can add a README and other files, but if you do it from the web, you will have to do Source Control > Pull in Xcode before you con commit other changes.
Now any time you make changes in Xcode, all you have to do is Commit and Push.
I learned this method mostly from here.
See also
The Basics of Git and GitHub
How to add a .gitignore file for Swift in Xcode
I just went through the process of doing this for several projects, and ran into some issues. Here was my process, mostly pieced together from the other answers on this page/site. Order is very important here
Open terminal and cd into the directory containing the .xcodeproj file
git init
In finder enter the newly created .git folder (in the same directory as the .xcodeproj file). Find info/exclude, open and add these lines, .DS_Store and xcuserdata/
Not sure if this is needed, but I used terminal to cp info/exclude over to a .gitignore file
git add .
git commit -m "Initial commit"
Now to get XCode to actually see the repo. In the project organizer, you first have to delete the project from the Projects tab. Then simply re-open the project to get it back. This will detect the GIT repository just created
In the repositories tab of the organizer I then branch off the master branch/switch into whatever version I'm working on.
Hopefully this helps someone without being too redundant. What now seems simple was definitely a challenge for someone new to GIT with existing projects
Check out my post on this topic Setting up a git repository in XCode for a pre-existing project. The above is correct, but it will include UserInterfaceState in your changes as you commit and this could be annoying because this file updates everytime you do anything in xcode, even if it is as simple and navigating through files or folders in your project.
if your XCODE 7 is not connecting with existing GIT repository. Try following
xcrun git config --global user.email your#email.com
xcrun git config --global user.name "your name"
Newer versions of Xcode simplify adding git to an existing Xcode project. Open your project in Xcode and choose Source Code > New Git Repositories. A sheet opens.
Select the checkbox next to the project and click the Create button to add git to the project.
Note:Specially for Xcode 11
CD to project directory using terminal
git init
git add .
git commit -m "Initial commit"
After this restart the Xcode and choose Source Control Navigator and then select the master and right click then choose option "Create Remote"

Resources