Don't recommend untemplated use of FlipperClient::getPlugin

Summary: We have a templated function not requiring a downcast, so there's no need to use the non-templated one.

Reviewed By: passy

Differential Revision: D15167856

fbshipit-source-id: 2f125ac9ca62d7ac4c633127104d1cd2954a13fb
This commit is contained in:
John Knox
2019-05-02 04:04:48 -07:00
committed by Facebook Github Bot
parent deff5e96db
commit 1d7b526add

View File

@@ -31,14 +31,8 @@ MyFlipperPlugin *myPlugin = [client pluginWithIdentifier:@"MyFlipperPlugin"];
```c++
auto &client = FlipperClient::instance();
// "MyFlipperPlugin is the return value of MyFlipperPlugin::identifier()
auto aPlugin = client.getPlugin("MyFlipperPlugin");
// aPlugin is a std::shared_ptr<FlipperPlugin>. Downcast to expected type.
auto myPlugin = std::static_pointer_cast<MyFlipperPlugin>(aPlugin);
// Alternatively, use the templated version
myPlugin = client.getPlugin<MyFlipperPlugin>("MyFlipperPlugin");
// "MyFlipperPlugin" is the return value of MyFlipperPlugin::identifier()
auto myPlugin = client.getPlugin<MyFlipperPlugin>("MyFlipperPlugin");
myPlugin->sendData(myData);
```