mirror of
https://github.com/NohamR/knowledge-kit.git
synced 2026-05-25 04:17:17 +00:00
docs: 批量博文
This commit is contained in:
21
Chapter1 - iOS/1.58.md
Normal file
21
Chapter1 - iOS/1.58.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Swift 版本迁移问题总结
|
||||
|
||||
> 工程中存在一部分代码逻辑是 Swift 实现的,每次 Swift 版本升级、Xcode 版本升级或许意味着你需要对 Swfit 实现的这部分代码进行升级改动,此篇文章就记录 Swift 每次升级时踩过的坑
|
||||
|
||||
## Swift 5 && Xcode 10.2 的踩坑
|
||||
|
||||
1. 一部分改动是由于系统通知的名称改变造成的
|
||||
|
||||
| 改动前 | 改动后 |
|
||||
|:--:|:--:|
|
||||
| .UIKeyboardWillShow | UIResponder.keyboardWillShowNotification |
|
||||
| UIAlertControllerStyle.alert | UIAlertController.Style.alert |
|
||||
| UIAlertActionStyle.cancel | UIAlertAction.Style.alert |
|
||||
| UIControlState.normal | UIControl.State.normal |
|
||||
| UIEdgeInsetsMake(0, 20, 0, 20) | UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) |
|
||||
| XQNetworkingManager.jsonManager | XQNetworkingManager.useJSONSerializer |
|
||||
| NSNotification.Name.UITextFieldTextDidChange | UITextField.textDidChangeNotification |
|
||||
|
||||
2. 当你修改完语法问题的时候,编译工程,发现还是存在一些问题。大体意思是说 Swift 的编译版本不再支持。所以我们需要选中 targets ,切换到 「Build Settings」 下面,搜索 「Swift Language Version」,在后面勾选合适的 Swift 版本。在这里我选择了 Swift 5
|
||||
|
||||
$$
|
||||
Reference in New Issue
Block a user