Subtitles section Play video Print subtitles (upbeat music) - [Steven Lipton] In Xcode 9, Apple made some significant changes concerning repositories in GitHub. So I'm going to explore repositories in Xcode and how to move them directly to GitHub without using the GitHub website or desktop application. We'll start with a new Xcode project. Before we do, head over to Preferences, and Source Control, and make sure that Source Control is enabled. Close Preferences. Head to File, New, Project. We'll pick an iOS project of Game since there's already usable SpriteKit code there. If you're not familiar with SpriteKit code, don't worry. I'll walk you through what changes we'll make. Click next. For our project name, call it "RepoDemo." Set your team, organization name, and organization identifier as you usually would. Set the language to Swift, and we're going to use SpriteKit for the game technology. Go ahead and hit next. I'm going to save it to the desktop, and most important of all here is make sure where it's a Source Control, you have a check next to "Create Git repository on my Mac." This will let you have the source control capabilities we're interested in. Go ahead and click create, and the project appears in Xcode. Run the app so you can see it as an animated Hello World app. Click your mouse on the app and the text pulses with a small square with rounded corners rotating. Stop the app. Click on the GameScene.swift file. Give yourself some room by closing the attributes if it's open. This code has two nodes, the shape and the label. The shape is generated here in code, the label in a GameScene.sks file. We'll change both of these in the GameScene.swift code. Under the if let label = self.label at line 21, I'm going to change the text to "Hello Pizza" and the font name to Georgia. Then I'll scroll on down, to line 29, and put right underneath that "let w equals" another line and I'm going to call it let h = w * 2.0. This will give us a height. The original code actually has both a width and a width, so it stays square, but I'm going to make this oblong and make it twice as high as it is wide. And then underneath that, you'll see the shape node here, and, it starts with rectOf. Change rect to ellipse. Okay. Change the height, to H, and this only has that one parameter, the corner radius doesn't apply so delete the corner radius. So that's our changes to our code. You can go ahead and run that. And we got a different experience. Okay, you can close that up. And take a look at this little M over here. This says that it's a modified file. You can see what the modifications are by going over to the version editor, clicking it once or clicking comparison. And you'll see a screen that has two sides of code, one the old code, one the new code. In between, you'll see things with little numbers. So for example, here we have the one for the shape node, and it's got two changes. I can discard those changes if I want, which I'm not going to do. And if you go up a little further, you can see one change 'cause they were blocked together of the two changes to the label. You'll also find at the top of the screen, a menu for source control. And here you've got all the classic things that you will find for Git or GitHub where you've got commit, push, pull, fetch and refresh, et cetera. And of course, clone on the bottom. Go ahead and hit commit. And you got a new window with the listed change files over here on the side. If you click on the GameScene.swift file, which is the only change we've got, you'll see again, it'll show you your changes. On the bottom, you'll find space for a commit message and I'm going to change to an oval shape and change the message to hello pizza. I can now go down the bottom here, which is commit one file, and commit the files. You'll find another little icon next to the navigator icon, which is over here. This is the source control navigator, and you'll open up its box, and open up branches. And you can see under branches, there's a master branch, and you can see the initial commit and our commit where we changed the shape. Besides storing your project locally in Xcode, starting with Xcode 9, you can store and share your project in GitHub. You'll need an account from github.com if you don't already have one. Once you have your GitHub account, in Xcode, go to Preferences > Accounts. Click the + and select GitHub. Click continue. Once selected, add your account and password. Mine is a MakeApp, and I'll type in my password. You'll see you now have a source control account. You can go ahead and close the preferences. Right-click on remotes, go to Create RepoDemo Remote on GitHub, and you get a creation screen. Set your account, and the owner, the repository name, and a description, which I'll put an example repository from Xcode. You can set it to public or private, and the remote name. Now you can change the repository name if you don't want to call it RepoDemo. So for example, I'm going to change it to my exercise name here, and hit create. I can go over to GitHub now, check my repositories, and right there is "Tips_01_Github." So this is how you save a project into GitHub. Once there, this is another GitHub project and acts like any other GitHub project. As of now, you can't do this to playgrounds. For a project like the one we just made, that's how you set up integration with GitHub from an Xcode repository. (upbeat music)
A2 github project repository commit file click iOS Development Tutorial - Xcode: Move repositories to GitHub 11 0 Summer posted on 2022/08/21 More Share Save Report Video vocabulary