Last updated Aug 19, 2025

Written by Shinwon Lee

1. Introduction

Welcome to this step! Here, you’ll build the foundation for your app by setting up the camera preview in Swift Playgrounds. Don’t worry if you’re new to UIKit or SwiftUI — we’ll guide you through it step by step.

What you’ll learn

✅ How to set up your Swift Playground environment

✅ How to configure project settings for camera access

✅ How to build a CameraViewController in UIKit to show the camera preview

✅ How to connect UIKit and SwiftUI so the camera view appears in your app

By the end of this tutorial, you’ll have a working live camera preview running inside Swift Playgrounds — a solid starting point before adding hand tracking and pinch gesture recognition in later sections.

Source Code

GitHub - LeeShinwon/Play-Melody at feature/camera-preview


2. Set up your Swift Playground environment

Editor