iOS/Swift

Swift) Realm 연동하기

Brad_Heo 2022. 10. 12. 09:56

Realm 연동하기

1. 터미널 프로젝트 경로로 이동

cd "프로젝트 경로"

2. CocoaPod 설치하기

sudo gem install cocoapods

3. Podfile 생성

pod init

4. Podfile 수정 (RealmSwift 추가) - nano 에디터 사용

sudo nano Podfile

4-1. Podfile에 pod 'RealmSwift' 내용 입력

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'ProjectManager' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  pod 'RealmSwift'
  # Pods for ProjectManager

end

위와 같이 내용 추가 후 아래 명령어 차례대로 입력 (nano 에디터 명령어)

  • ctrl + o(저장)
  • ctrl + x(나가기)

5. 추가한 모듈 설치 명령어 실행

pod install