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: "?")
)swiftTheme
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
| Property | Default | Used for |
|---|---|---|
fontFamily | .splineSans | All UI text |
displayFontFamily | same as fontFamily | The welcome heading |
emphasisFontFamily | .plexSerifItalic | The 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) }swiftSizes 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
| Field | Values | Default |
|---|---|---|
cart | .builtIn, .host, .off | .builtIn |
wishlist | .builtIn, .host, .off | .builtIn |
suggestions | .off, .starters, .startersAndFollowUps | .startersAndFollowUps |
suggestionPlacement | .aboveComposer, .inline | .aboveComposer |
feedback, newChat, trace, productTap, voice | Bool | true |
.builtInuses the Cartesian cart or wishlist and its drawer..hostsends taps to yourCartesianDelegate(onAddToCart,onOpenCart,onToggleSaved,onOpenWishlist). Push your state back withCartesian.host.setCart([id: qty])andCartesian.host.setSaved(ids)so badges and card checkmarks stay right. Items the assistant adds during a turn are also forwarded toonAddToCart..offhides 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| Slot | Receives | Default component |
|---|---|---|
header | controller, close action | Header |
connectionStatus | controller | ConnectionStatus |
emptyState | controller | EmptyState |
loading | controller | Loading |
userMessage | UserMessage, controller | UserMessageView |
assistantMessage | AssistantMessage, controller | AssistantMessageView |
trace | AssistantMessage, controller | Trace |
assistantText | AssistantMessage, controller | AssistantText |
productList | [Product], controller | ProductList |
productCard | Product, controller | ProductCard |
comparison | Comparison, controller | ComparisonView |
cartUpdate | CartUpdate, controller | CartUpdateView |
messageActions | AssistantMessage, controller | MessageActions |
suggestions | [String], controller | Suggestions |
composer | controller | Composer |
footer | controller | Footer |
drawer | controller | Drawer |
offline | controller | Offline |
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.