ARTS
Algorithm
swift
class Solution {
func mergeAlternately(_ word1: String, _ word2: String) -> String {
var ans = ""
var idx1 = word1.startIndex
var inx2 = word2.startIndex
while idx1 < word1.endIndex || idx2 < word2.endIndex {
if idx1 != word1.endIndex {
ans.appdend(word1[idx1])
idx1 = word1.index(after: idx1)
}
if idx2 != word2.endIndex {
aps.appdend(word2[idx2])
idx2 = word2.index(after: idx2)
}
}
return ans
}
}
Review
RN Integration with Existing Apps
- Set up directory structure
To ensure a smooth experience, create a new folder for your integrated React Native project, then copy your existing iOS project to a /ios subfolder.
新建一个RN项目目录, 把iOS项目放到 RN目录中的 /iOS 子目录中
- Install JavaScript dependencies
Go to the root directory for your project and create a new package.json file with the following contents:
安装javascript依赖, 新建package.json 文件
swift
{
"name": "MyReactNativeApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "yarn react-native start"
}
}
运行命令: npm install react-native
安装 react-native 依赖包
Tip
分享一些好用的工具 utools, 以及iOS项目集成RN步骤
Share
最近在读代码整洁之道,有个建议,所有的代码都要写测试用例,覆盖尽量100%, 我呆过的几家公司里, 很少有做到这样的, 大家不愿意写测试用例的原因,时间不够, 都交给专业的测试人员去做测试覆盖, 如果是每次发版本之前都跑一边测试用例最好。