Files
flipper/docs/setup/shared-preferences-plugin.mdx
John Knox 5f1a0548f5 Migrate website to Docusaurus 2
Summary:
Docusaurus 2 is quite a lot more powerful than docu 1 it turns out.
This should convert the website fully.

* [done] Go through migration guide https://v2.docusaurus.io/docs/migrating-from-v1-to-v2
* [done] Convert landing page html
* [done] Convert all images to img tags
* [done] Convert all .md files to .mdx
* [done] Make sure ui-doc generation and including still works
* [done] Scan every page visually for sanity check
* [done] Make sure footer still works
* [done] Make sure search still works
* [done] Change all links/ to links/index
* [done] Change all links.md to links
* [done] Add some custom css to make the navbar look like the old one and darken the footer.

Reviewed By: passy

Differential Revision: D21158717

fbshipit-source-id: 5f45b711b1b6fd5ece4c5c15c55635c7ebbfb568
2020-04-27 04:05:01 -07:00

42 lines
985 B
Plaintext

---
id: shared-preferences-plugin
title: Shared Preferences Setup
sidebar_label: Shared Preferences
---
This plugin is available for both Android and iOS.
## Android
```java
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
client.addPlugin(
new SharedPreferencesFlipperPlugin(context, "my_shared_preference_file"));
```
## iOS
If you want to use the Shared Preferences plugin, you need to add `FlipperKit/FlipperKitUserDefaultsPlugin` to your Podfile.
```ruby
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version
```
Initialize the plugin in the following way:
<!--DOCUSAURUS_CODE_TABS-->
<!--Objective-C-->
```objc
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:@"your_suitename"]];
```
<!--Swift-->
```swift
import FlipperKit
client?.add(FKUserDefaultsPlugin.init(suiteName: "your_suitename"))
```
<!--END_DOCUSAURUS_CODE_TABS-->