Hidde van der Ploeg on Nostr: If Self._printChanges() was your best friend debugging #SwiftUI views. Go ahead and ...
If Self._printChanges() was your best friend debugging #SwiftUI views.
Go ahead and try the new Self._logChanges() instead!
var body: some View {
#if DEBUG
let _ = Self._logChanges()
#endif
// … rest of view body …
}
It does the exact same thing but logs at the info level to the "com.apple.SwiftUI" which is cleaner (and easier to filter) in your console ✨
*In Xcode 15.1 and up
Published at
2023-11-05 13:11:32Event JSON
{
"id": "5e40811994bb409433367e4f03c2f774a81c22ee1cb6621eccae1d91dc35134b",
"pubkey": "cda5a8e762fccd9d847faa1e800b6d2c5aa1f52cc34bde21d5074e41b261780f",
"created_at": 1699189892,
"kind": 1,
"tags": [
[
"t",
"swiftui"
],
[
"t",
"if"
],
[
"t",
"endif"
],
[
"proxy",
"https://mastodon.design/users/hidde/statuses/111358108780823799",
"activitypub"
]
],
"content": "If Self._printChanges() was your best friend debugging #SwiftUI views. \n\nGo ahead and try the new Self._logChanges() instead!\n\nvar body: some View {\n#if DEBUG\n let _ = Self._logChanges()\n#endif\n // … rest of view body …\n }\n\nIt does the exact same thing but logs at the info level to the \"com.apple.SwiftUI\" which is cleaner (and easier to filter) in your console ✨\n\n*In Xcode 15.1 and up",
"sig": "34788b255cd7196c4d3438f69ff01ead70dc72d99dd19d03ac9617ae8a990a06f538bdb2aaaa5753461cbbc94fb4a35429a1317864e62154c169c441e36b8719"
}