The Marriage of Github and Xcode 9
The new Xcode integration allows you to do pretty much anything in Github directly from Xcode, like browsing repos and pushing commits.
Join the DZone community and get the full member experience.
Join For Freefinally, xcode and github have come together. since apple made a few projects open-source on github, more people got involved and contributed to those projects. the latest talk at wwdc 2017 on ' github and the new source control workflows in xcode 9 ' exposed how tightly xcode and github are integrated. now we can do almost everything on github from xcode, from creating repositories, pull, push, commit, tags, etc. in this post, we will see the new workflow of xcode and github integration, which covers
- setting up github in xcode,
- github source control navigator in xcode,
- committing from xcode,
- creating a remote github repo from xcode.
let's cover each of these integrations in brief with xcode 9 ; we need to have xcode 9 for this tutorial.
setting up github in xcode 9
this step assumes you have already downloaded the xcode 9 beta version from the downloads section of your apple developer account and you already have github account.
in the xcode preferences accounts tab, click on the + button to get a list of services like apple id, github, xcode server, and enterprise github.
we now need to select github and use our credentials to login into github and follow the instructions on the screen to complete the setup. you can provide clone method ssh to http. the github setup in xcode 9 is super simple.
in the above gif, we can see how easy it is to setup a github account in xcode and browse the github from xcode.
github navigator in xcode
xcode has introduced another navigator called 'source control navigator' near the project navigator. this shows all the information about branches, tags, and remotes about the current github repo. it also shows the commits in the main pain. i have an example below which shows detailed information about the xcfit github repository.
as you can see in the image, it's very detailed. we can browse through it easily.
commit from xcode
xcode now has the ability to pull, commit, and push from xcode. in order to demonstrate that, let's modify a file and right click on the file to get source control options. we can then commit the file with a commit message straight from xcode. the commit can be pushed using remote source using source control -> push options. we might need to provide our credentials or ssh key and branch for the commit.
create new github repo from xcode
if you are working on a new project, then you can create an entire github project and push to remote using xcode 9.
let's create a new project 'xcode-github' from xcode as a single view application. xcode will automatically add it under source control. we can create a remote repository using the option 'create xcfit remote on github.'
you can see that xcode-github is created and commits start appearing in the feed.
there are some useful features that xcode introduced for github but we will cover only those which are most important.
don't forget to watch the wwdc session ' github and the new source control workflows in xcode 9 ' to learn more.
Published at DZone with permission of Shashikant Jagtap, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments