The ability to deprecate features, components and paradigms is essential to the health of this project.
However, the price paid in disruption and maintenance is real; deprecating without warning, too often, or for poor rationale is a hinderance to adoption and contribution. It must be done with care and process.
Propose your deprecation on GitHub as an issue where the title's first phrase is “Deprecation [Component Name]”. Much like a feature proposal, the contributors have a responsibility to carefully judge the consequences of breaking changes against possible gains.
We should collaboratively answer the following questions:
Assuming that you’re looking at a one-month deprecation, then the schedule looks roughly like this:
A three-month deprecation is similar with more time for clients to adjust code:
Map this schedule onto reality:
Before announcing the deprecation, create an issue in GitHub that represents it. That issue will stay open until the deletion PR is submitted.
TODO: Include announcement instructions. Generally, this is done via blog.
Deprecate APIs using the macro provided by Apple in AvailabilityMacros.h that includes a message:
This macro requires an explanation string which should be similar to: ”This API will be removed on D/M/YYYY. Please use XYZ instead. See issue #n for more details.”
For any code that should be eventually deleted, add the following comment nearby to make it easier to find and remove the code: // DEPRECATION(github.com/material-components/material-components-ios/issues/n)
Once you submit the breaking PR, don’t immediately pile on subsequent PRs that would conflict with an emergency rollback.
Adding the deprecation warning (no breaking change) is a minor version bump.
Actually changing the code (breaking change) is a major version bump.
Changes that don‘t break anyone (or change behavior surprisingly) don’t need a deprecation.
This is an idealized summary of how to replace old code with new code.
If you are treating warnings as errors in your application via the -Werror
compiler flag, you may need to disable this functionality for deprecated code warnings.
This can be done by adding the -Wno-error=deprecated
and -Wno-error=deprecated-implementations
compiler flags to your application target via an .xcconfig or under “Other C Flags” in your Build Settings. Xcode will still issue the warning during compilation, but they will not be treated as errors.