Contact

The Contact model is the core data structure in the ContactsManager SDK that represents a person or organization. It contains basic information about the contact and references to related contact information components.

Properties

Identity

  • identifier: String - Unique identifier for the contact
  • id: String - Alias for identifier, conforming to Identifiable protocol

Basic Information

  • contactType: Int - Type of contact (0 = person, 1 = organization)

Name Components

  • namePrefix: String? - Title or honorific (e.g., Dr., Mr.)
  • givenName: String? - First name
  • middleName: String? - Middle name
  • familyName: String? - Last name
  • previousFamilyName: String? - Previous last name (e.g., maiden name)
  • nameSuffix: String? - Name suffix (e.g., “Jr.”, “III”)
  • nickname: String? - Informal name

Display Information

  • contactSection: String? - Section for alphabetical grouping
  • displayName: String? - Formatted full name for display

Organization Information

  • organizationName: String? - Company or organization name
  • departmentName: String? - Department within organization
  • jobTitle: String? - Professional title

Additional Information

  • notes: String? - General notes about the contact
  • bio: String? - Biographical information
  • location: String? - Geographic location

Image Data

  • imageUrl: String? - URL to contact’s avatar image
  • imageData: Data? - Full-size image data
  • thumbnailImageData: Data? - Optimized thumbnail image data
  • imageDataAvailable: Bool - Indicates if image data is available

Contact Information Lists

The Contact model contains collections of related information stored in separate models:

Additional Lists

  • interests: [String] - List of interests/hobbies
  • avatars: [String] - List of avatar URLs

Dates

  • birthday: Date? - Contact’s birthday
  • Important Dates - Collection of ContactDate objects
  • createdAt: Double - Creation timestamp

Metadata

  • matchString: String? - Searchable string containing all contact information
  • isDeleted: Bool - Soft deletion flag
  • parentContactId: String? - ID of parent contact if this is a linked contact
  • lastSyncedAt: Double? - Timestamp of last successful sync with server
  • dirtyTime: Double? - Last modification timestamp
  • sourceId: String? - External source identifier

Usage Example

// Create a new contact
let contact = Contact(
    identifier: UUID().uuidString,
    firstName: "John",
    lastName: "Doe"
)

// Add phone number
let phoneNumber = ContactPhoneNumber(
    contactId: contact.id,
    value: "+1234567890",
    type: "mobile",
    emoji: "📱"
)
contact.phoneNumbers.append(phoneNumber)

// Add email address
let email = ContactEmailAddress(
    contactId: contact.id,
    value: "john.doe@example.com",
    type: "work",
    emoji: "💼"
)
contact.emailAddresses.append(email)