Device Conditions and Environment Overrides
Device Conditions
Device-wide induced condition
Managed by Xcode
Tied to Xcode device connection
iOS status bar indicates when a condition is active
Can be stopped on deivce
Thermal state condition
Raises thermal state to - fair, serious, or critical
So you can reliably
·Understand app behavior under these elevated states
·Debug and verify your handling of thermal state changes
Network link condition
Real world profiles simulating network conditions
·High latency
·Low bandwidth
·High packet loss
·Slow DNS response
So you can reliably
·Understand and debug app behavior under various network conditions
Environment Overrides
Demo
可以设置网络状态和热状态?
可以在底部控制台设置黑暗模式与否
还可以更改控件大小来测试(SwiftUI)
Override runtime environment of debugged app
Overrides instantly
Only affects debugged app
System setting remain unchanged
Supports devices simulator, and previews
Available for all platforms
Debugging Live Previews
Live previews are debuggable
Workflows for previews
SwiftUI runtime issues
SwiftUI Runtime Issues
Found when process is running
Process continues executing
Details in Issues Navigator
All platforms and run destinations
Demo
直接改代码可以看到bug是否已经修复
可以点击Runtime Issue Breakpoint,在运行过程中执行断点调试
点击Editor-Previews-Refresh来进行刷新
Debugging Workflow
Use contextual menu to start debugging
New debug session for source changes
Keep the same file in main editor
Debugging SwiftUI View Hierarchies
Declarative API
Composition and lightweight modifiers over complex views
Value type semantics
Platform specific views at runtime
interoperability with UIKit and AppKit
SwiftUI 和 UIKit and AppKit可以一起使用
可以在右侧边栏看到具体的UI设定,从而加大找出问题的速度
View hierarchy in navigator and canvas
Properties and modifiers in inspector
Automatic inspector properties through Swift reflection
Custom inspector properties by adopting CustomReflectable
Support for mixed view hierarchies
View Hierarchy Debugging Improvements
UIWindowScene support
Inspectors
·Trait collections
·Named images
·Symbol images
·Named colors
·Improved constraint details
//More In WWDC
Designing for Advers Network and Temperature Conditions
LLDB: Beyond "po"