# Swift Sample Application¶

This sample takes images from the webcam and shows classification or detection results over the video stream in a window.

Language

Swift

Location

xnor-sdk-macos/samples/swift/Xnor SDK Sample Application.xcodeproj

Dependencies

None

Compatible Xnor Models

All classification and detection models

## Instructions¶

1. Double-click the .xcodeproj file to open it.

2. Click the Run (play icon) button in the Xcode toolbar, or press command-R.

3. You’ll be asked for permission to access the camera. Allow it.

The live overlay object detector will now play in a pop-up.

### Swapping Model Bundles¶

The provided sample application will use whatever model you give it. The model it uses is in XnorNet.framework inside of the sample directory (next to the .xcodeproj), so it’s straightforward to swap out the model:

1. Find the directory with the .xcodeproj.

2. Delete the existing XnorNet.framework.

3. Copy a new XnorNet.framework from xnor-sdk-macos/lib into the directory.

Say, for example, you want to switch to the facial expression classifier model. Then after deleting the existing XnorNet.framework, you could copy in xnor-sdk-macos/lib/facial-expression-classifier. To switch back, you could copy xnor-sdk-macos/lib/person-pet-vehicle-detector back in.