Swift SDK References and Release notes

SwiftSDK release notes

The release notes are managed with the actual code releases in the repository.

Swift SDK references

Classes

DYResult

public class DYResult {
    public let status: ResultStatus
    public let error: Error?
    public let warnings: [Warning]?
    public let rawNetworkData: RawNetworkData?
}
PropertyDescriptionType
statusThe status of the Choose call. If the type is "WARNING," it indicates that the request was successful, but there are warnings associated with the response.ResultStatus:
success, error, warning
warningsList of warnings returned from the server. Every warning item has a code and message.List<Warning>?
errorError and exception.Error?
rawNetworkDataNetwork-related data (for debugging purposes).RawNetworkData?

Page

public class Page: Encodable {
    let type: PageType
    let location: String
    let data: [String]
    let referrer: String?
    var locale: String?
}
PropertyDescriptionType
pageTypeThe current page typePageType
pageLocationThe current location. URL (for web), location (for SPA), or screen name (for mobile apps). Enables targeting the current page/screen.String
pageDataAdditional data for non-homepage pages: The SKU for a PRODUCT page, the category for a CATEGORY page, SKUs for the CART page, and the page ID in OTHER.List
pageReferrerThe previous location. URL (for web), location (for SPA), or screen name (for mobile apps). Enables targeting the previous page/screen.String?
localePage locale codeString?

ChooseOptions

public struct ChooseOptions {
    public var isImplicitPageview: Bool?
    public var returnAnalyticsMetadata: Bool?
    public var isImplicitImpressionMode: Bool?
}
PropertyDescriptionType
isImplicitPageviewDetermine whether to report a new pageview with the given context. Default is false. Set to true to report a new pageview with the given context. Keep as false if the Dynamic Yield script is implemented on the page. It reports the new pageview from the browser.Boolean
returnAnalyticsMetadataReturn additional metadata (display names & IDs for all entities). Useful for reporting to analytics tools. Set to true to return additional metadata (display names & IDs for all entities) for reporting to analytics tools.Boolean
isImplicitImpressionModeReport an impression of the chosen variation. This is set to true by default, which means that the user's impression of the variation is reported immediately when the variation is chosen. Pass this as false to report the impression explicitly in an Engagement call.Boolean

Facets

// Base type for facets. Use valuesType to determine the concrete type.
public protocol Facet: Decodable {
    var column: String { get }
    var displayName: String { get }
    var valuesType: FacetValuesType { get }
}
PropertyDescriptionType
columnColumn identifier the facet applies toString
displayNameHuman-readable label for the facetString
valuesTypeFacet value categoryFacetValuesType:number, string

NumberFacet

public class NumberFacet: Facet {
    public var column: String
    public var displayName: String
    public var valuesType: FacetValuesType
    public let min: Float
    public let max: Float
}
PropertyDescriptionType
columnColumn identifier the facet applies toString
displayNameHuman-readable label for the facetString
minMinimum value of the facet rangeFloat
maxMaximum value of the facet rangeFloat
valuesTypeFacet type for numeric valuesFacetValuesType

StringFacet

public class StringFacet: Facet {
    public var column: String
    public var displayName: String
    public var valuesType: FacetValuesType
    public let values: [StringFacetValue]
}
PropertyDescriptionType
columnColumn identifier the facet applies toString
displayNameHuman-readable label for the facetString
valuesAllowed string values for this facetList
valuesTypeFacet type for string valuesFacetValuesType

Widget

public struct Widget: Decodable {
    public let title: String
    public let slots: [RecsSlot]
}
PropertyDescriptionType
titleWidget titleString
slotsList of recommendation slots[RecsSlot]

Enums

Channel

public enum Channel: String, Codable, CaseIterable {
    case app = "APP"
    case kiosk = "KIOSK"
    case driveThru = "DRIVE-THRU"
}

DeviceType

public enum DeviceType: String, Codable, CaseIterable {
    case odmb = "ODMB"
    case smartphone = "SMARTPHONE"
    case tablet = "TABLET"
    case kiosk = "KIOSK"
}

PageType

public enum PageType: String, Codable, CaseIterable {
    case homepage = "HOMEPAGE"
    case category = "CATEGORY"
    case product = "PRODUCT"
    case cart = "CART"
    case other = "OTHER"
}

OrderFulfillment

public enum OrderFulfillment: String, Codable, CaseIterable {
  case delivery = "DELIVERY"
  case pickup = "PICKUP"
  case dinein = "DINEIN"
  case curbside = "CURBSIDE"
}

SortOrderType

public enum SortOrderType: String, Codable, CaseIterable {
    case asc = "ASC"
    case desc = "DESC"
}

VideoProgressType

enum class VideoProgressType: String, Codable, CaseIterable{
    case videoStarted = "VIDEO_STARTED",
    case prerollFinished = "PREROLL_FINISHED",
    case videoFinished = "VIDEO_FINISHED",
    case videoProgress = "VIDEO_PROGRESS"
}

FacetValuesType

public enum FacetValuesType: String, Decodable {
    case number
    case string
}