SCAppearanceConfiguration
@interface SCAppearanceConfiguration : NSObject
Configuration class used to customize the settings that influence the branding and coloring of UI elements used throughout the SDK.
Pass an instance of this class to the SCServiceCloud.appearanceConfiguration
property on the SCServiceCloud shared instance to set the appearance.
-
The appearance delegate, used for branding customization.
Declaration
Objective-C
@property (nonatomic, weak, nullable) NSObject<SCAppearanceConfigurationDelegate> *delegate;Swift
weak var delegate: SCAppearanceConfigurationDelegate? { get set } -
Property indicating whether any
UIAppearancesettings have been applied from this configuration instance.Declaration
Objective-C
@property (nonatomic, readonly, getter=isAppearanceApplied) BOOL appearanceApplied;Swift
var isAppearanceApplied: Bool { get } -
Controls whether the
UIAppearanceselectors need to be updated.Declaration
Objective-C
- (void)setNeedsAppearanceUpdates;Swift
func setNeedsAppearanceUpdates() -
Updates the
UIAppearanceselectors to reflect the current state of the configuration object.This method can be used to force appearance updates to occur at a particular time, or if there is cause for some branding changes to be reapplied.
Note
Updates are only applied if the appearance settings have indeed changed.
Declaration
Objective-C
- (void)applyAppearanceUpdatesIfNeeded;Swift
func applyAppearanceUpdatesIfNeeded()
-
Sets the color for the named
SCAppearanceConfigurationconstant.Declaration
Objective-C
- (void)setColor:(nonnull UIColor *)color forName:(nonnull SCSAppearanceColorToken)name;Swift
func setColor(_ color: UIColor, forName name: SCSAppearanceColorToken)Parameters
colorThe color to set.
nameThe branding token name to set the color for.
-
Returns the color set by the
-setColor:forName:method for the namedSCAppearanceConfigurationconstant.If no value has been specified, the default value is returned.
Declaration
Objective-C
- (nullable UIColor *)colorForName:(nonnull SCSAppearanceColorToken)name;Swift
func color(forName name: SCSAppearanceColorToken) -> UIColor?Parameters
nameThe branding token name to retrieve a color for.
Return Value
The color associated with that branding token, or
nilif the branding token name is invalid.
-
Sets the image for a named
SCAppearanceConfigurationconstant.Declaration
Objective-C
- (void)setImage:(nonnull UIImage *)image compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection forName:(nonnull SCSAppearanceImageToken)name;Swift
func setImage(_ image: UIImage, compatibleWithTraitCollection traitCollection: UITraitCollection?, forToken name: SCSAppearanceImageToken)Parameters
imageThe image to set.
traitCollectionThe trait collection the image will be used for, if applicable.
nameThe branding token name to set the image for.
-
Returns the image set by the
-setImage:compatibleWithTraitCollection:forName:method for the namedSCAppearanceConfigurationconstant.If no value has been specified, the default value is returned.
Declaration
Objective-C
- (nullable UIImage *)imageForName:(nonnull SCSAppearanceImageToken)name compatibleWithTraitCollection: (nullable UITraitCollection *)traitCollection;Swift
func image(forToken name: SCSAppearanceImageToken, compatibleWithTraitCollection traitCollection: UITraitCollection?) -> UIImage?Parameters
nameThe image name to retrieve an image for.
traitCollectionThe trait collection the image will be used for, if applicable.
-
Sets
fontDescriptorfor specified weight; used to create and set theUIFonton the labels.If
UIFontDescriptorSizeAttributeis set on thefontDescriptor, it is used to set the font size. If not, the SDK sets the font size appropriately.Declaration
Objective-C
- (void)setFontDescriptor:(nonnull UIFontDescriptor *)fontDescriptor fontFileName:(nullable NSString *)fileName forWeight:(NSInteger)weight;Swift
func setFontDescriptor(_ fontDescriptor: UIFontDescriptor, fontFileName fileName: String?, forWeight weight: Int)Parameters
fontDescriptorUIFontDescriptorinstance to be used for creatingUIFont.fileNameName of the font file contained in the bundle, or
nilwhen using a built-in system font.weightA value from the
SCFontWeightenum. -
Returns the
fontDescriptorfor the specified weight.If no value has been specified, the default value is returned. Default values:
Helvetica Neue - LightforSCFontWeightLight,Helvetica NeueforSCFontWeightRegular,Helvetica Neue - SemiboldforSCFontWeightBold.
Declaration
Objective-C
- (nonnull UIFontDescriptor *)getFontDescriptorForWeight:(NSInteger)weight;Swift
func getFontDescriptor(forWeight weight: Int) -> UIFontDescriptorParameters
weightA value from the
SCFontWeightenum. -
Returns the
fontDescriptorfor the specified weight.If no value has been specified, the default value is returned. Default values:
San FranciscowithUIFontWeightThinforSCFontWeightLightSan FranciscowithUIFontWeightRegularforSCFontWeightRegularSan FranciscowithUIFontWeightSemiboldforSCFontWeightBold
Declaration
Objective-C
- (nonnull UIFontDescriptor *)getFontDescriptorForWeight:(NSInteger)weight size:(CGFloat)size;Swift
func getFontDescriptor(forWeight weight: Int, size: CGFloat) -> UIFontDescriptorParameters
weightThe font weight:
SCFontWeightLight,SCFontWeightRegular, orSCFontWeightBold.sizeSize of the desired font
-
Gets the font filename for a given weight.
Declaration
Objective-C
- (nullable NSString *)getFontFileNameForWeight:(NSInteger)weight;Swift
func getFontFileName(forWeight weight: Int) -> String?Parameters
weightThe font weight:
SCFontWeightLight,SCFontWeightRegular, orSCFontWeightBold.Return Value
The font filename.
-
Sets the attributed text attributes for the named
SCAppearanceConfigurationconstant.Declaration
Objective-C
- (void)setTextAttributes:(nonnull NSDictionary<NSString *, id> *)attributes compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection forName:(nonnull SCSAppearanceLabelToken)name;Swift
func setTextAttributes(_ attributes: [String : Any], compatibleWith traitCollection: UITraitCollection?, forName name: SCSAppearanceLabelToken)Parameters
attributesThe text attributes to set.
traitCollectionThe trait collection these attributes will be used for, if applicable.
nameThe branding token name to set the attributes for.
-
Returns the text attribute set by the
-setTextAttributes:compatibleWithTraitCollection:forName:method for the namedSCAppearanceConfigurationconstant.If no value has been specified, the default value is returned.
Declaration
Objective-C
- (nullable NSDictionary<NSString *, id> *) textAttributesForName:(nonnull SCSAppearanceLabelToken)name compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection;Swift
func textAttributes(forName name: SCSAppearanceLabelToken, compatibleWith traitCollection: UITraitCollection?) -> [String : Any]?Parameters
nameThe branding token name to retrieve the attributes for.
traitCollectionThe trait collection these attributes will be used for, if applicable.
-
Property for storing global CSS that will be used to customize the appearance of article content.
This will be appended to the built-in CSS that is produced based on the other color, and font, styles defined within this
SCAppearanceConfigurationobject, but before the per-article CSS resource is loaded.Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *globalArticleCSS;Swift
var globalArticleCSS: String? { get set } -
Property for storing global Javascript that will be used to customize the appearance or behavior of article content.
This javascript will be loaded at the end of the HTML body, but before the per-article javascript resource that may be used.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *globalArticleJavascript;Swift
var globalArticleJavascript: String? { get set }
Install in Dash
SCAppearanceConfiguration Class Reference