Summary: We have a bunch of code blocks using languages that aren't rendered by default, so adding syntax highlighting for those languages. Also, some uses are using the wrong "name" for the language, so I've fixed them. Reviewed By: mweststrate Differential Revision: D21974341 fbshipit-source-id: 17146ea5ae4979241c51b3707035470e9742a104
42 lines
991 B
Plaintext
42 lines
991 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-->
|
|
```objectivec
|
|
#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-->
|