Configure the OpenWeb iOS SDK's appearance and behavior through the OWCustomizations protocol to align with your brand identity. Customize themes, fonts, navigation, and UI elements.
With the OpenWeb SDK's OWCustomizations protocol, you can craft a unique, unified appearance that aligns with your brand's identity.
Through OWCustomizations, you can achieve the following:
Modify the sort settings of comments through the OWSortingCustomizations protocol or aligning sort option names with specific branding terminology
Adapt your app's appearance through the theme settings of the OWTheme
Tailor UI elements, such as headers and navigation, through the OWCustomizableElementCallback callback
public protocol OWCustomizations {
var commentActions: OWCommentActionsCustomizations { get set }
var fontFamily: OWFontGroupFamily { get set }
var sorting: OWSortingCustomizations { get }
var themeEnforcement: OWThemeStyleEnforcement { get set }
var statusBarEnforcement: OWStatusBarEnforcement { get set }
var navigationBarEnforcement: OWNavigationBarEnforcement { get set }
var customizedTheme: OWTheme { get set }
func addElementCallback(_ callback: @escaping OWCustomizableElementCallback)
}
The following sections explain how to configure and define these settings.
Customization Settings
Comment Actions
let manager: OWManagerProtocol = OpenWeb.manager
let customizations: OWCustomizations = manager.ui.customizations
customizations.commentActions = OWCommentActionsCustomizations
Color of the main separators: Directly beneath the page title, Directly beneath the Conversation snippet, Between parent messages
secondarySeparatorColor
Color of pipe separator between the numbers of total comments and total commenters
tertiarySeparatorColor
Color of the separators surrounding the comments pane: Beneath Sort by filter, Beneath last visible comment, Midline dots between Reply link and Share link
Color of other text items: Article text, Comment date, Icons (Like, Dislike), Number of comments, Reply link, Share link, Sort by label, Text field placeholder text, Username of original commenter
class HostApplicationNavigationController: UINavigationController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return topViewController?.preferredStatusBarStyle ?? .default
}
}
let manager: OWManagerProtocol = OpenWeb.manager
let customizations: OWCustomizations = manager.ui.customizations
customizations.statusBarEnforcement = OWStatusBarEnforcement
Property
Description
OWStatusBarEnforcement OWStatusBarEnforcement
Defines the status bar appearance to enforce. See: OWStatusBarEnforcement
Theme Enforcement
let manager: OWManagerProtocol = OpenWeb.manager
let customizations: OWCustomizations = manager.ui.customizations
customizations.themeEnforcement = OWThemeStyleEnforcement
Property
Description
OWThemeStyleEnforcement OWThemeStyleEnforcement
Enforces either dark or light mode for the entire SDK, regardless of the device's active theme mode. See: OWThemeStyleEnforcement
UI Customization
The SDK allows you to customize UI elements.
let manager: OWManagerProtocol = OpenWeb.manager
let customizations: OWCustomizations = manager.ui.customizations
let customizableClosure: OWCustomizableElementCallback = { element, source, style, postId in
switch element {
case .communityQuestion(let textView):
// Do your customizations to the text view
case .default:
break
}
}
customizations.addElementCallback(customizableClosure) // Allow multiple callbacks
Options for customizing the login prompt. Possible Values: .arrowIcon(imageView: UIImageView), .lockIcon(imageView: UIImageView), .title(label: UILabel)
User interface component to customize. See: OWCustomizableElement
postId string
Unique article identifier that is specific to the article page. Ideal postId: aligns with URL slug or article ID, less than 50 characters, uses letters/numbers/dashes/hyphens, no special characters
sourceType OWViewSourceType
Location of the user interface element. See: OWViewSourceType
style OWThemeStyle
Theme to apply to the element. See: OWThemeStyle
OWFontGroupFamily
Setting
Description
OWFontGroupFamily OWFontGroupFamily
Options to set the UI font. Possible Values: .default, .custom(fontFamily: String)
Sets the theme style that is enforced. See: OWThemeStyle
OWViewSourceType
Setting
Description
OWViewSourceType string
Options for a user interface location when customizing UI elements. Possible Values: .preConversation, .conversation, .commentCreation, .commentThread, .reportReason