스트리밍은 대부분의 브라우저와
Developer 앱에서 사용할 수 있습니다.
-
Review code and collaborate in Xcode
Explore the latest enhancements to code review and pull requests in Xcode. Learn more about diff display preferences, commit selectors, changes navigator, and pull request workflows. We'll show you how you can collaborate with your team and find regressions by connecting your code review and PR workflows directly to your source code.
리소스
관련 비디오
WWDC21
-
다운로드
Hi, everyone. My name is Kieran, and I'm an Xcode engineer working on source control technologies. Xcode 13 completely reimagines code review mode and introduces brand new collaboration workflows to help you improve the quality of your app. In this session, I'll walk you through a typical workflow with our app Fruta. We'll use the new code review and pull request features in Xcode 13 to find a bug, get feedback, integrate those changes, and provide feedback to my colleagues. Let's get started. A big part of my work is looking into issues that our users reported. In order to fix a bug, I first have to understand when and why it started happening. By stepping back in time through my code changes, I can often figure out the cause using code review mode. One of the App Store reviews we had mentioned that some UI changes recently made to our app don't look quite right. I have a pretty good idea what the issues are, so I'll go ahead and start making some changes. As I start typing, the changes appear in the source editor's gutter. I find it really useful to know what the previous values were so I can have a good idea of everything that's changed. For this, I can jump into code review mode. Simply click on the Code Review button in the editor bar to see the comparison of local edits against the most recent revision.
As I'm working on my document, code review mode continuously highlights the edits I'm making so I always know what's changed since my last commit.
When I've made multiple edits to a file, the stepper control in the bottom bar shows me how many changes I've made. Clicking the arrow icons will jump between my code changes. That way, I don't have to scroll through the file looking for the edits myself. Sometimes it can be easier to see what's changed side-by-side, but I prefer to see my changes in-line. Xcode can show me my changes in either style, and I can flip between the two using the Editor menu at the top right. I want to ensure that I've caught every issue with the UI bug. To really dig in and understand where a bug came from, I need to see what's changed between releases of my app. I can use the commit controls in the bottom bar to set up those comparisons. Xcode 13 allows me to choose commits across my branches, tags, and most recent locations so I can easily see the changes in my app between any two points in time. I usually cut a release branch every time I submit to TestFlights or the App Store, so I'll take a look at two versions of my code related to that release.
With my commit selected, Xcode shows me a comparison of the two historical versions of my document. The highlight colors change to purple and orange, corresponding with the commits displayed in the bottom bar. As before, I can jump between changes using the stepper control.
I can see the comparison either in-line or side-by-side. When I'm done exploring this comparison, I can quickly snap back to my most recent changes using the Reset button in the bottom bar. Usually, the changes that I make to my apps span across multiple files. While it's really useful to explore changes within one file, I often want an overview for all of the files that I've changed across my whole project. Thanks to the new Changes tab in the Source Control Navigator, I can see a list of all the files I've changed since my last commit. Clicking on any of them will automatically enter code review mode and show me all the changes that I've made in that file. I like to flip between the files to quickly remind myself of the other edits I've made. Now that I know why our app has this issue when displaying ingredients, I'll go ahead and create a new branch with my changes to fix it. Creating and switching branches is something I do a lot, and Xcode 13 has a great new way to do that. Xcode's toolbar now shows my current branch, which is a helpful reminder of what I was last working on. By clicking on it, I can quickly switch between any of the branches that I worked on recently. In this case, I'll use the secondary menu to create a branch for my fix.
After exploring history in code review mode, I was able to come up with a fix for the bug. Now that I have a proposed solution, I want to get feedback on my code change. Since I'm not totally familiar with this part of the code base, I'd like my teammates to confirm that my changes won't introduce other issues. To collaborate with my peers on a code change, I'll create a pull request. I can do that right from Xcode 13 using its new integrated support for GitHub and Bitbucket Server. I can create my pull requests right from the source control popover. Xcode will create a draft pull request to merge with my branch into the default upstream branch, which in this case is main. I can prepare my pull request with information about the fix before publishing it. The changes that I've committed and pushed to my branch will show up in the Pull Request section in the Changes Navigator, giving me a preview of the changes that will be included once published. The Local Changes section lets me see files that won't be included in my pull request until I commit and push them. When I'm happy with the contents of my pull request, I'll give it a title and a description.
I'd like to ask a few teammates in particular to review this change, so I'll click the Participants button and tag them as Reviewers.
As I wait for feedback and switch to other branches, Xcode figures out which pull request to display. Xcode will determine the associated pull request based on its source branch and your current branch. When you switch branches, Xcode will automatically discover existing pull requests. I published my pull request a little while ago, and my team has since left me some feedback. Let's take a look at that now. With the pull request selected in the Changes Navigator, I can see an overview of my pull request and everything that's happened since I published it. My team has left me some feedback on my code. I can reply to these discussions if I like or click "View Changes" to jump straight into the file in code review mode.
There are some great suggestions in here from Matt, and now we have the opportunity to have this conversation about my pull request in Xcode and connect it directly to source code. I went ahead and updated my pull request in response to the feedback. Now, looking at the comments that my teammates have left here it looks like they're on board with my latest change. I see that my colleague has approved this pull request. Now I just need to check my status of our continuous integration workflow. Since I'm using Xcode Cloud, I can also see the status of my continuous integration workflows within the pull request's CI popover. I'm able to quickly see a summary of my test results, and clicking on an entry will jump me straight into a detailed Xcode Cloud report. For more information about Xcode Cloud and running your code in CI, check out the session "Meet Xcode Cloud." OK, since my teammates have all approved my changes and all of my Xcode Cloud jobs have succeeded, I'm ready to merge my pull request. I'll use the Pull Request actions and select "Merge." Xcode allows me to select a merge strategy which determines how changes are integrated into the target branch. I'll choose the default, which will include a Merge Commit. You can also enter an optional commit message, but I'll leave it as it is. Everything looks good, so I'll merge it now.
Now that I've merged my pull request, it's time to switch back to other work. Just like I find it helpful to ask my peers for their feedback, they often ask me to review their changes, too.
In addition to branches I've worked on recently, the source control popover also shows me the pull requests that are relevant to me. I'll see the pull requests that I've created, but Xcode also shows me any pull requests that my teammates have requested I review. Looking in the source control popover, it looks like one of my teammates has asked me to do just that. Let's check out their branch and review it. Just like with my own pull requests, I can see his overview, review status, and discussions on my teammates' pull requests since I've been tagged in. Let's take a look at their changes. I'll step through the files in the Changes Navigator under the pull request node.
Clicking on any of these will snap me into code review mode, showing me the changes that will be applied if the pull request is merged. I can leave a comment for him inside the editor by secondary clicking and inserting a new comment on the line. I think I see a potential improvement in his code, so let's leave a note for my teammate.
My feedback was pretty minor, and this pull request looks good to go. I'll approve it using the actions in the top right.
Xcode 13 offers great new ways to review code and collaborate with your peers. Code review mode is a powerful tool for investigating issues and behavioral changes in your app by giving you insight into how your app's source code has changed over time. Code review mode also provides you with a new in-line presentation mode and expanded comparison options to allow for more flexibility for your workflow. Pull requests allow you to collaborate with your team to improve your app's code quality by giving and receiving code feedback on your team's changes before merging them into the main branch. Discussions show up right in your app's source code, making teamwork truly part of the development process. Thank you, have a great WWDC, and . [percussive music]
-
-
찾고 계신 콘텐츠가 있나요? 위에 주제를 입력하고 원하는 내용을 바로 검색해 보세요.
쿼리를 제출하는 중에 오류가 발생했습니다. 인터넷 연결을 확인하고 다시 시도해 주세요.