You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Ink] Update Readme to use the script generator and move migration guide. (#7370)
Ink readme wasn't using the script generator and ready templates we already use in our other components. This fixes that and moves the migration guide from Ripple to Ink.
<!-- Extracted from docs/migration-guide-ink-to-ripple.md -->
226
+
227
+
### Migration guide: Ink to Ripple
228
+
229
+
Ink and Ripple provide similar APIs: a view (`MDCInkView`, `MDCRippleView`), and a touch controller (`MDCInkTouchController`, `MDCRippleTouchController`).
230
+
231
+
While Ripple and Ink’s implementations slightly vary, the public APIs are nearly identical. Furthermore, Ripple’s API does not produce additional side effects and can be used interchangeably.
232
+
233
+
These two notions make the migration path from Ink to Ripple relatively simple.
234
+
235
+
For guidance, these are the current naming differences that you need to pay attention to when migrating:
*\*Ripple provides a more convenient API if the ink's initialized view is the view that the ink is then added to. All you need is to initialize the ripple with `initWithView:` and there is no need to use an equivalent `addInkView` afterwards.*
265
+
266
+
**Based on the above guidance, the overall strategy to migrate Ink to Ripple in each component is as follows:**
267
+
268
+
<ul class="icon-list">
269
+
<li class="icon-list-item icon-list-item">Provide an enableRippleBehavior bool property to allow to opt-in to use Ripple instead of Ink (where the default to this property is NO).</li>
270
+
</ul>
271
+
272
+
Component Header:
273
+
```objc
274
+
/*
275
+
This property determines if an @c <#INSERT CLASS NAME> should use the @c MDCRippleView behavior or not.
276
+
By setting this property to @c YES, @c MDCRippleView is used to provide the user visual
277
+
touch feedback, instead of the legacy @c MDCInkView.
<liclass="icon-list-item icon-list-item">Add the RippleView/RippleTouchController APIs beside their InkView/InkTouchController counterparts.</li>
301
+
</ul>
302
+
303
+
<ulclass="icon-list">
304
+
<liclass="icon-list-item icon-list-item">If the component itself has public APIs that use the term "Ink" like “InkStyle” or “InkColor”, the developer should add APIs to use the term “Ripple” instead. When Ink will eventually be deprecated, these APIs will be deprecated as part of that process. Another option instead of exposing specific Ripple APIs is to expose the `MDCRippleView` property in the public API.</li>
**NOTE:** The ink touch controller does not keep a strong reference to the view to which it is attaching the ink view.
93
+
An easy way to prevent the ink touch controller from being deallocated prematurely is to make it a property of a view controller (like in these examples.)
94
+
95
+
### MDCInkView
96
+
97
+
Alternatively, you can use MCDInkView directly to display ink ripples using your
0 commit comments