0Pricing
SwiftUI Academy · 강의

SwiftUI 앱 파일의 구조

@main, App, WindowGroup, ContentView의 의미를 이해합니다.

SwiftUI 앱 파일의 구조은(는) CoddyKit의 무료 SwiftUI Academy 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 SwiftUI Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. SwiftUI Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

The App File

Every SwiftUI project has a file named after your app, like MyFirstApp.swift. This app file is the true entry point where your whole app begins. 📱

The @main Marker

The @main attribute tells Swift exactly where your program starts. iOS launches your app by running the type marked with it.

@main
struct MyFirstApp: App {
}

Conforming to App

Your main struct conforms to the App protocol. This is the SwiftUI blueprint for an application, describing what scenes it shows.

The body Property

Inside the App struct, a body property describes your app's scenes. SwiftUI reads it to know what to display when the app launches.

var body: some Scene {
    WindowGroup {
        ContentView()
    }
}

Scenes, Not Views

The app's body returns a Scene, not a View. A scene is a container for a window or screen that holds your actual views inside it.

WindowGroup

WindowGroup is the most common scene. It manages your app's main window and, on iPhone, simply fills the whole screen.

Your Root View

Inside WindowGroup you place your root view, usually ContentView(). It is the first screen the user sees when the app opens.

ContentView Lives Apart

ContentView sits in its own file, separate from the app file. Keeping the entry point and the UI apart keeps your project tidy and clear.

How It Flows

The chain is simple: @main starts the App, the App shows a WindowGroup, and the WindowGroup displays your ContentView. ✨

One @main Only

An app can have just one @main entry point. The template already provides it, so you rarely add or change this part yourself.

Where You Work

You will spend most of your time editing views like ContentView, not the app file. The app file mostly just wires everything together.

Quick Check

What is the job of the WindowGroup scene in the app file?

Recap

You learned the chain: @main on the App struct returns a WindowGroup scene that shows ContentView. That is how a SwiftUI app boots up. 🧩

자주 묻는 질문

“SwiftUI 앱 파일의 구조” 강의는 무료인가요?

네 — “SwiftUI 앱 파일의 구조” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 SwiftUI Academy 강의 전체를 잠금 해제할 수 있습니다. SwiftUI Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

“SwiftUI 앱 파일의 구조”에서 뭘 배우나요?

@main, App, WindowGroup, ContentView의 의미를 이해합니다. 브라우저에서 직접 실행하는 실습 코드로 SwiftUI Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

SwiftUI Academy을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 SwiftUI Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“SwiftUI 앱 파일의 구조” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 SwiftUI Academy 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 SwiftUI Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. Xcode 설치 및 프로젝트 생성
  2. SwiftUI 앱 파일의 구조
  3. 실시간 미리보기 캔버스
  4. 시뮬레이터 및 기기에서 실행하기
← SwiftUI Academy(으)로 돌아가기