RxSwift関連の総オブジェクト数出力


元ネタはこちらです。
http://qiita.com/ShingoFukuyama/items/20035171f9ec78efded7

RxSwift 3.0 version だとビルドできないようでしたので改めて記述しなおすと以下になります。


    let timer = Timer(timeInterval: 3.0, target: BlockOperation.init(block: {
        print("Resource count \(RxSwift.Resources.total)")
    }), selector: #selector(Operation.main), userInfo: nil, repeats: true)
    RunLoop.main.add(timer, forMode: .commonModes)


RxSwiftをデバッグビルドしていないと、RxSwift.Resources.total の定義が無いよ、と怒られてビルド失敗します。
Carthageを使っている場合は

carthage bootstrap RxSwift --configuration Debug

と、Debugをつけてビルドする必要がありちょっと面倒です。