Integrating NSUserDefaults plugin to iOS (#291)

Summary:
I have a few details left, but its almost done. This PR addresses #145

- The NSUserDefaults plugin uses the SharedPreferences Desktop Part since we can reuse all of it.
- The NSUserDefaults plugin uses swizzling in order to be notified of what specific event changed at runtime.
- Added Test harness in both Sample Swift and Sample apps for iOS in order to test the plugin.
- Updated the documentation in `docs/shared-preferences-plugin.md` and` README.md`

I am open to suggestions since the desktop sharedPreferences version doesn't support deletion of preferences. Most likely I would have to modify the UI, and for that matter, I might as well build a user defaults desktop version

I wanted to add xiphirx in this MR since he developed the shared preferences plugin for Android and Desktop. I don't see a way to remove preferences from the flipper desktop app so I was wondering if you would be OK with me adding that.
Pull Request resolved: https://github.com/facebook/flipper/pull/291

Reviewed By: passy

Differential Revision: D10334685

Pulled By: priteshrnandgaonkar

fbshipit-source-id: d798c01a46df7ddecf713924799f046b560ea922
This commit is contained in:
Marc Terns
2018-10-12 04:07:39 -07:00
committed by Facebook Github Bot
parent 233b7bcd3c
commit c7ad49a9eb
21 changed files with 557 additions and 53 deletions

View File

@@ -7,8 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
322121E8134CB1102F388691 /* libPods-SampleSwift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6233B2BCBACBB2E8D715CC04 /* libPods-SampleSwift.a */; };
4E102343216ADB5900160734 /* UserDefaultsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E102342216ADB5900160734 /* UserDefaultsViewController.swift */; };
532FF2DF211316ED00FC5A10 /* NetworkViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 532FF2DE211316ED00FC5A10 /* NetworkViewController.swift */; };
629899EF3F77DD9CC9462399 /* libPods-SampleSwift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 54D075F591C612F4A46C4C50 /* libPods-SampleSwift.a */; };
A19C402720E20023004BF1F7 /* Icons.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A19C402620E20023004BF1F7 /* Icons.xcassets */; };
A1EC522D20DED61B007C6977 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EC522C20DED61B007C6977 /* AppDelegate.swift */; };
A1EC522F20DED61B007C6977 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EC522E20DED61B007C6977 /* ViewController.swift */; };
@@ -17,10 +18,11 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
4E102342216ADB5900160734 /* UserDefaultsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsViewController.swift; sourceTree = "<group>"; };
532FF2DE211316ED00FC5A10 /* NetworkViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkViewController.swift; sourceTree = "<group>"; };
54D075F591C612F4A46C4C50 /* libPods-SampleSwift.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SampleSwift.a"; sourceTree = BUILT_PRODUCTS_DIR; };
59BC319BD0C305C87CCBB954 /* Pods-SampleSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleSwift.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SampleSwift/Pods-SampleSwift.debug.xcconfig"; sourceTree = "<group>"; };
76A1EA0FA19A4343BF5468B9 /* Pods-SampleSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleSwift.release.xcconfig"; path = "Pods/Target Support Files/Pods-SampleSwift/Pods-SampleSwift.release.xcconfig"; sourceTree = "<group>"; };
6233B2BCBACBB2E8D715CC04 /* libPods-SampleSwift.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SampleSwift.a"; sourceTree = BUILT_PRODUCTS_DIR; };
82933F6ACB19D9FAA4A0B0DC /* Pods-SampleSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleSwift.release.xcconfig"; path = "Pods/Target Support Files/Pods-SampleSwift/Pods-SampleSwift.release.xcconfig"; sourceTree = "<group>"; };
871A353CDDB4CD0F4FE9A564 /* Pods-SampleSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleSwift.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SampleSwift/Pods-SampleSwift.debug.xcconfig"; sourceTree = "<group>"; };
A19C402620E20023004BF1F7 /* Icons.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Icons.xcassets; sourceTree = SOURCE_ROOT; };
A1EC522920DED61B007C6977 /* SampleSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleSwift.app; sourceTree = BUILT_PRODUCTS_DIR; };
A1EC522C20DED61B007C6977 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -35,20 +37,28 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
629899EF3F77DD9CC9462399 /* libPods-SampleSwift.a in Frameworks */,
322121E8134CB1102F388691 /* libPods-SampleSwift.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
690EC1830793DEC228432979 /* Frameworks */ = {
isa = PBXGroup;
children = (
6233B2BCBACBB2E8D715CC04 /* libPods-SampleSwift.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
A1EC522020DED61B007C6977 = {
isa = PBXGroup;
children = (
A1EC522B20DED61B007C6977 /* SampleSwift */,
A1EC522A20DED61B007C6977 /* Products */,
D64C1609A23F7F455EB46170 /* Pods */,
FCE001267EA01B99C44EBA11 /* Frameworks */,
B8EB61E9CA5FC85959AD5F3E /* Pods */,
690EC1830793DEC228432979 /* Frameworks */,
);
sourceTree = "<group>";
};
@@ -70,27 +80,20 @@
A1EC523520DED61C007C6977 /* LaunchScreen.storyboard */,
A1EC523820DED61C007C6977 /* Info.plist */,
532FF2DE211316ED00FC5A10 /* NetworkViewController.swift */,
4E102342216ADB5900160734 /* UserDefaultsViewController.swift */,
);
path = SampleSwift;
sourceTree = "<group>";
};
D64C1609A23F7F455EB46170 /* Pods */ = {
B8EB61E9CA5FC85959AD5F3E /* Pods */ = {
isa = PBXGroup;
children = (
59BC319BD0C305C87CCBB954 /* Pods-SampleSwift.debug.xcconfig */,
76A1EA0FA19A4343BF5468B9 /* Pods-SampleSwift.release.xcconfig */,
871A353CDDB4CD0F4FE9A564 /* Pods-SampleSwift.debug.xcconfig */,
82933F6ACB19D9FAA4A0B0DC /* Pods-SampleSwift.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
FCE001267EA01B99C44EBA11 /* Frameworks */ = {
isa = PBXGroup;
children = (
54D075F591C612F4A46C4C50 /* libPods-SampleSwift.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -98,7 +101,7 @@
isa = PBXNativeTarget;
buildConfigurationList = A1EC523B20DED61C007C6977 /* Build configuration list for PBXNativeTarget "SampleSwift" */;
buildPhases = (
FEB6C3EADB1D3B088347CC11 /* [CP] Check Pods Manifest.lock */,
D9A91DD7C5294D8508D0A168 /* [CP] Check Pods Manifest.lock */,
A1EC522520DED61B007C6977 /* Sources */,
A1EC522620DED61B007C6977 /* Frameworks */,
A1EC522720DED61B007C6977 /* Resources */,
@@ -159,7 +162,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
FEB6C3EADB1D3B088347CC11 /* [CP] Check Pods Manifest.lock */ = {
D9A91DD7C5294D8508D0A168 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -186,6 +189,7 @@
files = (
A1EC522F20DED61B007C6977 /* ViewController.swift in Sources */,
532FF2DF211316ED00FC5A10 /* NetworkViewController.swift in Sources */,
4E102343216ADB5900160734 /* UserDefaultsViewController.swift in Sources */,
A1EC522D20DED61B007C6977 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -320,7 +324,7 @@
};
A1EC523C20DED61C007C6977 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 59BC319BD0C305C87CCBB954 /* Pods-SampleSwift.debug.xcconfig */;
baseConfigurationReference = 871A353CDDB4CD0F4FE9A564 /* Pods-SampleSwift.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
@@ -384,7 +388,7 @@
};
A1EC523D20DED61C007C6977 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 76A1EA0FA19A4343BF5468B9 /* Pods-SampleSwift.release.xcconfig */;
baseConfigurationReference = 82933F6ACB19D9FAA4A0B0DC /* Pods-SampleSwift.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;