mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-20 08:27:32 +08:00
38 lines
1.1 KiB
Plaintext
38 lines
1.1 KiB
Plaintext
### Typography Theming
|
|
|
|
You can theme <#a_component_name#> with your app's typography scheme using the TypographyThemer extension.
|
|
|
|
You must first add the TypographyThemer extension to your project:
|
|
|
|
```bash
|
|
pod 'MaterialComponents/<#component#>+TypographyThemer'
|
|
```
|
|
|
|
<!--<div class="material-code-render" markdown="1">-->
|
|
#### Swift
|
|
```swift
|
|
// Step 1: Import the TypographyThemer extension
|
|
import MaterialComponents.Material<#component#>_TypographyThemer
|
|
|
|
// Step 2: Create or get a typography scheme
|
|
let typographyScheme = MDCTypographyScheme()
|
|
|
|
// Step 3: Apply the typography scheme to your component
|
|
<#typography_themer_api#>.applyTypographyScheme(typographyScheme, to: component)
|
|
```
|
|
|
|
#### Objective-C
|
|
|
|
```objc
|
|
// Step 1: Import the TypographyThemer extension
|
|
#import "Material<#component#>+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
|
|
[<#typography_themer_api#> applyTypographyScheme:colorScheme
|
|
to<#themer_parameter_name#>:component];
|
|
```
|
|
<!--</div>-->
|