[ios] 연락처 저장하기
import Contacts

func saveContact(name: String, phoneNumber: String) {
    let contactStore = CNContactStore()
    let contact = CNMutableContact()
    contact.givenName = name
    contact.phoneNumbers = [CNLabeledValue(label: CNLabelPhoneNumberMain, value: CNPhoneNumber(stringValue: phoneNumber))]
    
    let saveRequest = CNSaveRequest()
    saveRequest.add(contact, toContainerWithIdentifier: nil)
    
    do {
        try contactStore.execute(saveRequest)
        print("Contact saved successfully!")
    } catch {
        print("Error saving contact: \(error.localizedDescription)")
    }
}

위의 예시에서는 사용자의 이름과 전화번호를 입력하여 연락처를 저장하는 코드를 보여줍니다. 이 코드는 Contacts 프레임워크를 사용하여 연락처를 생성하고 저장하는 방법을 보여줍니다.

더 많은 정보를 얻고 싶다면 Apple Developer Documentation를 참고해 보세요.