Cartesiandocs

iOS SDK

Customize

Theme, fonts, features, strings and slots for the iOS UI kit.

Everything is set through CartesianOptions, passed to Cartesian.configure(_:options:) or Cartesian.update(options:), or per view with CartesianChatView(options:) and .cartesianPanel(state, options:).

let options = CartesianOptions(
    theme: CartesianTheme(
        colors: CartesianColors(accent: Color(hex: 0x14804A), primary: Color(hex: 0x0B5C34)),
        fontFamily: .system(),
        cornerRadius: 16,
        showOrb: true
    ),
    title: "FreshMart Assistant",
    starters: ["Dinner for 4 under $30", "What's on sale this week?"],
    features: CartesianFeatures(cart: .host, wishlist: .off, suggestionPlacement: .aboveComposer),
    strings: CartesianStrings(placeholder: "Ask about any product").heading("What are you ", emphasis: "cooking", after: "?")
)
swift

Theme

CartesianColors has the same tokens as Android, with the same defaults: background ivory #FEFAF1, ink black, accent #004CFF, stone neutrals for line, lineStrong, inkMuted, inkSubtle, inkFaint, wine #8C2B2B for sale and badge, forest #2F6A4A for success. Every parameter is optional.

Fonts

PropertyDefaultUsed for
fontFamily.splineSansAll UI text
displayFontFamilysame as fontFamilyThe welcome heading
emphasisFontFamily.plexSerifItalicThe emphasised word in the heading

A CartesianFontFamily can be any font:

.system(design: .rounded)                                     // SF
.custom("Avenir Next")                                        // one family, weight applied by SwiftUI
.custom(regular: "Brand-Regular", medium: "Brand-Medium", semibold: "Brand-SemiBold")
CartesianFontFamily { size, weight in .custom("Brand", fixedSize: size).weight(weight) }
swift

Sizes follow Dynamic Type: the SDK scales them with the body text style, up to accessibility size 2.

cornerRadius sets the radius of product cards, comparison and cart-update cards. showOrb: false replaces the animated orb with a sparkles icon.

Features

FieldValuesDefault
cart.builtIn, .host, .off.builtIn
wishlist.builtIn, .host, .off.builtIn
suggestions.off, .starters, .startersAndFollowUps.startersAndFollowUps
suggestionPlacement.aboveComposer, .inline.aboveComposer
feedback, newChat, trace, productTap, voiceBooltrue
  • .builtIn uses the Cartesian cart or wishlist and its drawer.
  • .host sends taps to your CartesianDelegate (onAddToCart, onOpenCart, onToggleSaved, onOpenWishlist). Push your state back with Cartesian.host.setCart([id: qty]) and Cartesian.host.setSaved(ids) so badges and card checkmarks stay right. Items the assistant adds during a turn are also forwarded to onAddToCart.
  • .off hides the buttons.

Follow-up suggestions are fetched after each finished answer. With .aboveComposer they show as one horizontal row of chips attached above the composer, hidden while an answer is running or the shopper is typing. With .inline they show under the last answer.

Strings

CartesianStrings overrides the copy: heading(_:emphasis:after:), subtitle, placeholder, disclaimer, cartName (for example "bag") and signedOut. Anything you leave out uses the vertical's default text. The title in CartesianOptions replaces "Cartesian" in the placeholder and disclaimer.

Slots

Every part of the chat can be replaced. Slots are closures that receive the CartesianChatController, so your view can read state and call actions. Wrap the default with CartesianComponents to add to it rather than rebuild it:

let slots = CartesianSlots()
    .productCard { product, controller in
        VStack {
            CartesianComponents.ProductCard(product, controller)
            Text("Aisle \(product.aisle ?? "—")").font(.caption)
        }
    }
    .footer { _ in EmptyView() }
    .header { controller, close in
        MyHeader(title: controller.assistantName, onClose: close)
    }

CartesianOptions(slots: slots)
swift
SlotReceivesDefault component
headercontroller, close actionHeader
connectionStatuscontrollerConnectionStatus
emptyStatecontrollerEmptyState
loadingcontrollerLoading
userMessageUserMessage, controllerUserMessageView
assistantMessageAssistantMessage, controllerAssistantMessageView
traceAssistantMessage, controllerTrace
assistantTextAssistantMessage, controllerAssistantText
productList[Product], controllerProductList
productCardProduct, controllerProductCard
comparisonComparison, controllerComparisonView
cartUpdateCartUpdate, controllerCartUpdateView
messageActionsAssistantMessage, controllerMessageActions
suggestions[String], controllerSuggestions
composercontrollerComposer
footercontrollerFooter
drawercontrollerDrawer
offlinecontrollerOffline

CartesianComponents.Orb(.searching, size: 32) exposes the agent orb for your own views.

White label

Pass a licence key in CartesianConfig(licenseKey:). It is verified offline (ES256) against your bundle identifier and expiry. A valid white-label licence hides the "Powered by CogitX Cartesian" line; controller.isWhiteLabel and controller.license tell you the result.