mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-20 08:27:32 +08:00
This PR adds the shape theming API documentation using the doc generation script improvements that were added in PR #5463 . To achieve this, I added into the .vars files of the supported components the missing variables, and ran the script `scripts/apply_all_templates`. Then I ran `scripts/generate_readme component` for the components that have been added the `shape-theming.md` file, so it is seen in the actual README.md of the component. Specifically, Bottom Sheet was using the old method of documentation, and wasn't using the right generation method, so it's doc content was just copied to the right location to allow its generation to work well as well. Closes #5319
1.1 KiB
1.1 KiB
Shape Theming
You can theme buttons with your app's shape scheme using the ShapeThemer extension.
You must first add the ShapeThemer extension to your project:
pod 'MaterialComponents/Buttons+ShapeThemer'
Swift
// Step 1: Import the ShapeThemer extension
import MaterialComponents.MaterialButtons_ShapeThemer
// Step 2: Create or get a shape scheme
let shapeScheme = MDCShapeScheme()
// Step 3: Apply the shape scheme to your component
MDCButtonShapeThemer.applyShapeScheme(shapeScheme, to: component)
MDCFloatingButtonShapeThemer.applyShapeScheme(shapeScheme, to: component)
Objective-C
// Step 1: Import the ShapeThemer extension
#import "MaterialButtons+ShapeThemer.h"
// Step 2: Create or get a shape scheme
id<MDCShapeScheming> shapeScheme = [[MDCShapeScheme alloc] init];
// Step 3: Apply the shape scheme to your component
[MDCButtonShapeThemer applyShapeScheme:shapeScheme
toButton:component];
[MDCFloatingButtonShapeThemer applyShapeScheme:shapeScheme
toButton:component];