ios-native.mdx (SetUp - Generic iOS Apps)

Summary: Restyle of the page, including changes to spelling, grammar, links, and structure (where relevant).

Reviewed By: lblasa

Differential Revision: D36275804

fbshipit-source-id: 4d6538b0c3123dfd88980b05bee3cbb2b9c3d4f2
This commit is contained in:
Kevin Strider
2022-05-10 09:09:57 -07:00
committed by Facebook GitHub Bot
parent 14b83ad050
commit 40fa16aac1

View File

@@ -1,6 +1,6 @@
--- ---
id: ios-native id: ios-native
title: Adding Flipper to iOS apps title: Adding Flipper to Generic iOS Apps
sidebar_label: Generic iOS apps sidebar_label: Generic iOS apps
--- ---
@@ -9,11 +9,13 @@ import Link from "@docusaurus/Link";
import Tabs from "@theme/Tabs"; import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem"; import TabItem from "@theme/TabItem";
We support both Swift and Objective-C for Flipper with CocoaPods as build and distribution mechanism. :::note
Swift and Objective-C are supported for Flipper with CocoaPods as build and distribution mechanism.
:::
## CocoaPods ## CocoaPods
The following configuration assumed CocoaPods 1.9+. The following configuration assumes CocoaPods 1.9+:
```ruby ```ruby
project 'MyApp.xcodeproj' project 'MyApp.xcodeproj'
@@ -72,22 +74,22 @@ end
## For pure Objective-C projects ## For pure Objective-C projects
For pure Objective-C projects, add the following things in your settings: For pure Objective-C projects, add the following to your settings:
1. `/usr/lib/swift` as the first entry of the `LD_RUNPATH_SEARCH_PATHS` 1. `/usr/lib/swift` as the first entry of the `LD_RUNPATH_SEARCH_PATHS`
2. Add the following in `LIBRARY_SEARCH_PATHS` 2. Add the following in `LIBRARY_SEARCH_PATHS`
``` ```bash
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
``` ```
3. If after the above two steps there are still error's like `Undefined symbol _swift_getFunctionReplacement` then set `DEAD_CODE_STRIPPING` to `YES`. Reference for this fix is [here](https://forums.swift.org/t/undefined-symbol-swift-getfunctionreplacement/30495/4) 3. If, after following the above two steps, there are still errors such as `Undefined symbol _swift_getFunctionReplacement`, then set `DEAD_CODE_STRIPPING` to `YES`. The reference for this fix is in the [Swift forum](https://forums.swift.org/t/undefined-symbol-swift-getfunctionreplacement/30495/4)
This is done to overcome a bug with Xcode 11 which fails to compile swift code when bitcode is enabled. Flipper transitively depends on YogaKit which is written in Swift. More about this issue can be found [here](https://twitter.com/krzyzanowskim/status/1151549874653081601?s=21) and [here](https://github.com/Carthage/Carthage/issues/2825). This is done to overcome a bug with Xcode 11 which fails to compile Swift code when bitcode is enabled. Flipper transitively depends on YogaKit, which is written in Swift.
For more information about this issue, refer to the Swift code [tweet](https://twitter.com/krzyzanowskim/status/1151549874653081601?s=21) and [Github issue](https://github.com/Carthage/Carthage/issues/2825).
Install the dependencies by running `pod install`. You can now import and initialize Flipper in your Install the dependencies by running `pod install`. You can now import and initialize Flipper in yourAppDelegate.
AppDelegate.
<Tabs defaultValue="objC" values={[{ label: 'ObjC', value: 'objC'}, { label: 'Swift', value: 'swift'}]}> <Tabs defaultValue="objC" values={[{ label: 'ObjC', value: 'objC'}, { label: 'Swift', value: 'swift'}]}>
<TabItem value="objC"> <TabItem value="objC">
@@ -147,8 +149,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
## Enabling plugins ## Enabling plugins
Finally, you need to add plugins to your Flipper client. Above, we have only added the Layout Inspector plugin to get you started. See <Link to={useBaseUrl("/docs/setup/plugins/network")}>Network Plugin</Link> and <Link to={useBaseUrl("/docs/setup/layout-plugin")}>Layout Inspector Plugin</Link> for information on how to add them, and also enable Litho or ComponentKit support. You can check the sample apps in the [GitHub repo](https://github.com/facebook/flipper) for examples of integrating other plugins. Finally, you need to add plugins to your Flipper client. The Layout Inspector plugin is shown above to get you started.
See <Link to={useBaseUrl("/docs/setup/plugins/network")}>Network Plugin</Link> and [Layoutj Inspector Plugin](https://www.internalfb.com/intern/staticdocs/flipper/docs/features/plugins/inspector/) for information on how to add them and enable Litho or ComponentKit support. You can check the sample apps in the [GitHub repo](https://github.com/facebook/flipper) for examples of integrating other plugins.
## Having trouble? ## Questions or issues
See the <Link to={useBaseUrl("/docs/troubleshooting")}>troubleshooting page</Link> for help with known problems. If you have any questions or issues, refer to the <Link to={useBaseUrl("/docs/troubleshooting")}>troubleshooting</Link> page, or post the details on the [Flipper Support](https://fb.workplace.com/groups/flippersupport) Workplace group.