React Native용 iOS Bridging Header 설정

발행: (2025년 12월 17일 오전 03:51 GMT+9)
2 min read
원문: Dev.to

Source: Dev.to

Bridging Header 설정하기

  1. Bridging Header 파일 만들기

    • Xcode에서 프로젝트 폴더를 우클릭합니다.
    • New FileHeader File을 선택합니다.
    • 파일 이름을 YourAppName-Bridging-Header.h 로 지정합니다.
    • 모든 타깃(메인 앱, 개발, 프로덕션)을 선택하고 Create를 클릭합니다.
  2. Bridging Header 경로 설정하기
    각 타깃마다:

    • Build Settings를 엽니다.
    • **“Objective‑C Bridging Header”**를 검색합니다.
    • 경로를 YourAppName/YourAppName-Bridging-Header.h 로 지정합니다.

Objective‑C 헤더 가져오기

YourAppName-Bridging-Header.h 를 열고 필요한 import 를 추가합니다. 예시:

// React Native Config
#import "RNCConfig.h"

// Google Maps
#import 

// Your custom modules
#import "CustomNativeModule.h"

AppDelegate.swift 예시

import UIKit
import Firebase   // 사용한다면 Firebase를 반드시 import

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // React Native Config를 통해 환경 변수에 접근
        if let apiKey = RNCConfig.env(for: "API_KEY") {
            GMSServices.provideAPIKey(apiKey)
        }

        // Firebase 초기화
        FirebaseApp.configure()

        return true
    }
}

정리, 빌드, 실행

  • Clean: Cmd + Shift + K
  • Build: Cmd + B
  • Run: Cmd + R

프로젝트 구조 개요

YourAppName/
├── ios/
│   ├── YourAppName/
│   │   ├── AppDelegate.swift
│   │   ├── YourAppName-Bridging-Header.h  ✅
│   │   └── Info.plist
│   └── Pods/
└── package.json
Back to Blog

관련 글

더 보기 »

Swift와 UIkit에서 사용자 정의 폰트

소개 이 튜토리얼에서는 Swift와 UIKit에서 사용자 정의 폰트를 사용하는 방법을 보여드리겠습니다. Montserrat와 Hind 폰트를 사용할 것이며, 이 폰트들은 …에서 다운로드할 수 있습니다.