Skip to content

Commit

Permalink
Update the README.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaoyuang committed May 6, 2022
1 parent 6ad1106 commit 44f53ad
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,49 @@ dependencies {
}
```

Kotlin/Native on macOS:

```kotlin
dependencies {
// Intel Chip
implementation("com.ctrip.flight.mmkv:mmkv-kotlin-macosx64:1.1.1")

// M1 Chip
implementation("com.ctrip.flight.mmkv:mmkv-kotlin-macosarm64:1.1.1")
}
```
Note, if you want to import MMKV-Kotlin to your Kotlin/Native executable project that target is macOS, you need to manually add dependency on MMKV, and add `linkerOpts` on MMKV and MMKVCore:

```
kotlin {
macosX64 {
binaries {
// ......
all {
val mmkvPath = "${buildDir.absolutePath}/cocoapods/synthetic/OSX/mmkv_operator/build/Release/MMKV"
val mmkvCorePath = "${buildDir.absolutePath}/cocoapods/synthetic/OSX/mmkv_operator/build/Release/MMKVCore"
linkerOpts += listOf(
"-F$mmkvPath",
"-rpath", mmkvPath,
"-framework", "MMKV",
"-F$mmkvCorePath",
"-rpath", mmkvCorePath,
"-framework", "MMKVCore"
)
}
}
}
cocoapods {
// ......
pod(name = "MMKV") {
version = "1.2.13"
moduleName = "MMKV"
}
}
// ......
}
```

### Initialization and Configure Root Path

You can initialize MMKV when app or process initialization. [MMKV-Android](https://github.com/Tencent/MMKV/tree/master/Android/MMKV) initialization API depends on [Context](https://developer.android.com/reference/android/content/Context). So, Android's initialization API is different from iOS.
Expand Down
43 changes: 43 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,49 @@ dependencies {
}
```

Kotlin/Native on macOS:

```kotlin
dependencies {
// Intel 芯片
implementation("com.ctrip.flight.mmkv:mmkv-kotlin-macosx64:1.1.1")

// M1 芯片
implementation("com.ctrip.flight.mmkv:mmkv-kotlin-macosarm64:1.1.1")
}
```
注意,如果您在目标平台为 macOS 的 Kotlin/Native 可执行程序工程中导入 MMKV-Kotlin,您需要手动在工程中添加对 MMKV 的依赖,并添加对 MMKV 及 MMKVCore 的 `linkerOpts`

```
kotlin {
macosX64 {
binaries {
// ......
all {
val mmkvPath = "${buildDir.absolutePath}/cocoapods/synthetic/OSX/mmkv_operator/build/Release/MMKV"
val mmkvCorePath = "${buildDir.absolutePath}/cocoapods/synthetic/OSX/mmkv_operator/build/Release/MMKVCore"
linkerOpts += listOf(
"-F$mmkvPath",
"-rpath", mmkvPath,
"-framework", "MMKV",
"-F$mmkvCorePath",
"-rpath", mmkvCorePath,
"-framework", "MMKVCore"
)
}
}
}
cocoapods {
// ......
pod(name = "MMKV") {
version = "1.2.13"
moduleName = "MMKV"
}
}
// ......
}
```

### 初始化与配置根目录

可在 App 或进程启动时初始化 MMKV。由于 [MMKV-Android](https://github.com/Tencent/MMKV/tree/master/Android/MMKV) 的初始化 API 依赖 [MMKV](https://github.com/Tencent/MMKV),因此 Android 与 iOS 平台初始化 API 有所不同。
Expand Down

0 comments on commit 44f53ad

Please sign in to comment.