Xcode10.2中LLDB增長的新特性

本次更新共增長三條特性,分別是:express

  • 支持LLDB中的closure使用$0、$1等快捷變量
  • 增長新命令v/vo
  • 支持C 長度可變的數組C variable length arrays are now supported in LLDB.(不理解啥意思🤣,但願知道的大神能在評論區裏不吝賜教)

下面舉例說明一下前兩條的用法。數組

支持LLDB中的closure使用$0、$1等快捷變量

示例代碼:xcode

po [1,2,3,4].filter({$0 == 1})
複製代碼

示例截圖:bash

新命令 v/vo

該命令用來輸出當前棧框架的變量,由於它繞過了表達式評估程序(expression evaluator),因此它要比p/po更高效,更推薦使用v/vo來代替p/poapp

示例代碼:框架

class ViewController: UIViewController {

    var testStr: String!
    var testInt: Int!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        testPropertyPrint()
    }
    
    func testPropertyPrint() {
        testStr = "string"
        testInt = 10
        
        var arr = [1,2,3,4,5]
    }
}
複製代碼

示例截圖:ide

相關文章
相關標籤/搜索