Theming
You can customize the look and feel of all UI components provided by LikeMindsFeed. The SDK allows you to change the appearance of components such as colors and fonts via the Appearance configuration. Changes to appearance should be done as early as possible in your application lifecycle, the SceneDelegate
and AppDelegate
are usually the right places to do this. The SDK comes with a singleton object Appearance.default
that you can use directly to make changes.
Changing Colors and Fonts
The colors and fonts are part of the Appearance
configuration type. Since all components have access to this configuration, all components will be impacted by the changes on this configuration.
In the following example, we are changing the app tint color (i.e. theme color) of the app and the heading font.
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
LMFeedAppearance.shared.colors.appTintColor = .green
LMFeedAppearance.shared.fonts.headingFont1 = .systemFont(ofSize: 20, weight: .medium)
...
return true
}
}
The full list of customizations exposed by LMFeedAppearance is available here and here.
Changing Image Assets
The image assets and icons used by buttons use the Constants configuration type. Since all components have access to this configuration, all components will be impacted by the changes on this configuration. For example, let's modify the icon used for the "heart" button:
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
LMFeedConstants.shared.images.heart = UIImage(systemName: "heart.fill")!
...
return true
}
}
The full list of customizations exposed by LMFeedConstants is available here
If an image fails to load, a fallback circle image will be used instead.