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
UIAppearance
settings 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
UIAppearance
selectors need to be updated.Declaration
Objective-C
- (void)setNeedsAppearanceUpdates;
Swift
func setNeedsAppearanceUpdates()
-
Updates the
UIAppearance
selectors 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
SCAppearanceConfiguration
constant.Declaration
Objective-C
- (void)setColor:(nonnull UIColor *)color forName:(nonnull SCSAppearanceColorToken)name;
Swift
func setColor(_ color: UIColor, forName name: SCSAppearanceColorToken)
Parameters
color
The color to set.
name
The branding token name to set the color for.
-
Returns the color set by the
-setColor:forName:
method for the namedSCAppearanceConfiguration
constant.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
name
The branding token name to retrieve a color for.
Return Value
The color associated with that branding token, or
nil
if the branding token name is invalid.
-
Sets the image for a named
SCAppearanceConfiguration
constant.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
image
The image to set.
traitCollection
The trait collection the image will be used for, if applicable.
name
The branding token name to set the image for.
-
Returns the image set by the
-setImage:compatibleWithTraitCollection:forName:
method for the namedSCAppearanceConfiguration
constant.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
name
The image name to retrieve an image for.
traitCollection
The trait collection the image will be used for, if applicable.
-
Sets
fontDescriptor
for specified weight; used to create and set theUIFont
on the labels.If
UIFontDescriptorSizeAttribute
is 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
fontDescriptor
UIFontDescriptor
instance to be used for creatingUIFont
.fileName
Name of the font file contained in the bundle, or
nil
when using a built-in system font.weight
A value from the
SCFontWeight
enum. -
Returns the
fontDescriptor
for the specified weight.If no value has been specified, the default value is returned. Default values:
Helvetica Neue - Light
forSCFontWeightLight
,Helvetica Neue
forSCFontWeightRegular
,Helvetica Neue - Semibold
forSCFontWeightBold
.
Declaration
Objective-C
- (nonnull UIFontDescriptor *)getFontDescriptorForWeight:(NSInteger)weight;
Swift
func getFontDescriptor(forWeight weight: Int) -> UIFontDescriptor
Parameters
weight
A value from the
SCFontWeight
enum. -
Returns the
fontDescriptor
for the specified weight.If no value has been specified, the default value is returned. Default values:
San Francisco
withUIFontWeightThin
forSCFontWeightLight
San Francisco
withUIFontWeightRegular
forSCFontWeightRegular
San Francisco
withUIFontWeightSemibold
forSCFontWeightBold
Declaration
Objective-C
- (nonnull UIFontDescriptor *)getFontDescriptorForWeight:(NSInteger)weight size:(CGFloat)size;
Swift
func getFontDescriptor(forWeight weight: Int, size: CGFloat) -> UIFontDescriptor
Parameters
weight
The font weight:
SCFontWeightLight
,SCFontWeightRegular
, orSCFontWeightBold
.size
Size 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
weight
The font weight:
SCFontWeightLight
,SCFontWeightRegular
, orSCFontWeightBold
.Return Value
The font filename.
-
Sets the attributed text attributes for the named
SCAppearanceConfiguration
constant.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
attributes
The text attributes to set.
traitCollection
The trait collection these attributes will be used for, if applicable.
name
The branding token name to set the attributes for.
-
Returns the text attribute set by the
-setTextAttributes:compatibleWithTraitCollection:forName:
method for the namedSCAppearanceConfiguration
constant.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
name
The branding token name to retrieve the attributes for.
traitCollection
The 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
SCAppearanceConfiguration
object, 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 }