Sometimes a project requires additional targets for unit testing or deployment. See how to create additional targets in Xcode in this video.
- [Instructor] Our discussion on debugging…wouldn't be complete without talking about unit tests.…To create unit tests for an Apple platform in Xcode…you first need a class to test.…So what I'm going to do is create a new class here…that's really simple and it's just for running a unit test.…So I have my ViewController class here selected,…I'll press Command + N to create a new file.…Under macOS I'll choose Cocoa Class…and then hit Return or Next,…and then give this class a name.…
I'll just call it Example and then hit Return.…And then Return one more time to create the class.…So here is my Example class.…In here I'm going to create a property called exampleProp…and that's just going to be a string…with the value of example.…So save that file.…And then our next step is to create a test target.…And this process is the same whether you're on macOS or iOS…or another Apple platform.…
Select your project in the project navigator…and then you want to hit the plus button in the Targets area…to add a new target.…If you don't see the area with Targets…
- 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.