iOS Swift Conversion (#2527)

Converts iOS implementation from Objective-c to Swift

# During the conversion process some updates to the code structure were also made
- Modularize codebase from single file to smaller focused files
- Untangled large nested IF statements
- Added more null checks, since Swift is more strict with null pointers
- Added property to allow for decoding of local video sources with self contained key for offline playback
- Updates example apps to test react-native 0.63.4 and uses auto native dependency imports for android and ios
This commit is contained in:
Nick Fujita
2022-05-19 22:29:25 +09:00
committed by GitHub
parent d681e5505f
commit 68b9db4d11
138 changed files with 8869 additions and 7589 deletions

View File

@@ -33,6 +33,10 @@ Version 3.0 features a number of changes to existing behavior. See [Updating](#u
* [Android](#android-installation)
* [Windows](#windows-installation)
* [react-native-dom](#react-native-dom-installation)
* [Examples](#examples)
* [iOS](#ios-example)
* [Android](#android-example)
* [Windows](#windows-example)
* [Usage](#usage)
* [iOS App Transport Security](#ios-app-transport-security)
* [Audio Mixing](#audio-mixing)
@@ -69,6 +73,12 @@ Run `npx pod-install`. Linking is not required in React Native 0.60 and above.
Run `react-native link react-native-video` to link the react-native-video library.
#### Enable Static Linking for dependencies in your ios project Podfile
Add `use_frameworks! :linkage => :static` just under `platform :ios` in your ios project Podfile.
[See the example ios project for reference](examples/basic/ios/Podfile#L5)
#### Using CocoaPods (required to enable caching)
Setup your Podfile like it is described in the [react-native documentation](https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies).
@@ -166,6 +176,11 @@ android.enableJetifier=true
#### **MainApplication.java**
If using com.facebook.react.PackageList to auto import native dependencies, there are no updates required here. Please see the android example project for more details.
/examples/basic/android/app/src/main/java/com/videoplayer/MainApplication.java
##### For manual linking
On top, where imports are:
```java
@@ -257,6 +272,25 @@ const ReactNativeDomOptions = {
```
</details>
## Examples
Run `yarn xbasic install` before running any of the examples.
### iOS Example
```
yarn xbasic ios
```
### Android Example
```
yarn xbasic android
```
### Windows Example
```
yarn xbasic windows
```
## Usage
```javascript
@@ -926,6 +960,18 @@ Adjust the volume.
Platforms: all
#### localSourceEncryptionKeyScheme
Set the url scheme for stream encryption key for local assets
Type: String
Example:
```
localSourceEncryptionKeyScheme="my-offline-key"
```
Platforms: iOS
### Event props
@@ -1404,6 +1450,16 @@ To enable audio to play in background on iOS the audio session needs to be set t
## Updating
### Version 6.0.0
#### iOS
In your project Podfile add support for static dependency linking. This is required to support the new Promises subdependency in the iOS swift conversion.
Add `use_frameworks! :linkage => :static` just under `platform :ios` in your ios project Podfile.
[See the example ios project for reference](examples/basic/ios/Podfile#L5)
### Version 5.0.0
Probably you want to update your gradle version: