Snippets are reusable blocks of code and can be used across projects to avoid typing the same code more than once. In this video, learn how to get snippets working in your projects.
- [Instructor] Have you ever found yourself…writing the same block of code for multiple projects?…And maybe that block of code is too small…so that it would be an inconvenience…to make it reusable in a framework.…For that type of code,…you can actually use code snippets…and save a block of code within Xcode for later use.…Let's look at how code snippets can be created.…Simply select a block of code,…right click it,…and choose Create Code Snippet.…
Once you've done that,…the Snippets menu pops up…and you're able to give your code snippet a Title.…We'll just call this Example Snippet right here…and we can give it a Summary or description.…Let's say it adds two numbers and returns the sum.…You can choose a specific platform if you want to.…I'll just leave All there.…You can specify a language.…So I'll choose Swift.…You can give it a completion shortcut if you want.…
So if you type a certain keyword,…then it will actually automatically be completed for you.…For now I won't put anything there.…And then you can also specify completion scopes.…
- Installing Xcode
- Creating your first project
- Editing code
- Creating snippets
- Prototyping in playgrounds
- Implementing version control with Git
- Building and connecting the interface
- Compiling and debugging apps in Xcode
- Creating workspaces for sharing resources and code
Skill Level Beginner
1. Getting Started
2. Edit Code
3. Source Control
4. Interface Builder Basics
5. Compile and Debug
Create a workspace2m 51s
Next steps1m 5s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.