mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-20 08:27:32 +08:00
This discourages depending on all of a component's extensions and aligns our targets more closely with how we expect them to be imported and depended upon. This is a breaking change. Pivotal story: https://www.pivotaltracker.com/story/show/157118721
1.1 KiB
1.1 KiB
Typography Theming
You can theme a navigation bar with your app's typography scheme using the TypographyThemer extension.
You must first add the Typography Themer extension to your project:
pod 'MaterialComponents/NavigationBar+TypographyThemer'
Swift
// Step 1: Import the TypographyThemer extension
import MaterialComponents.MaterialNavigationBar_TypographyThemer
// Step 2: Create or get a typography scheme
let typographyScheme = MDCTypographyScheme()
// Step 3: Apply the typography scheme to your component
MDCNavigationBarTypographyThemer.applyTypographyScheme(typographyScheme, to: component)
Objective-C
// Step 1: Import the TypographyThemer extension
#import "MaterialNavigationBar+TypographyThemer.h"
// Step 2: Create or get a typography scheme
id<MDCTypographyScheming> typographyScheme = [[MDCTypographyScheme alloc] init];
// Step 3: Apply the typography scheme to your component
[MDCNavigationBarTypographyThemer applyTypographyScheme:colorScheme
toNavigationBar:component];