RxSwift开启资源计数的方法:
1). pod文件最后添加:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'RxSwift'
target.build_configurations.each do |config|
if config.name == 'Debug'
config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['-D', 'TRACE_RESOURCES']
end
end
end
end
end
并重新install
2). 找到项目中的RxSwift target,在它的Debug配置中,添加-D TRACE_RESOURCES编译参数(貌似默认就配置上了?)
3). 打印
print("Resource tracing: \(RxSwift.Resources.total)")