Customize autocaptured screen names
SwiftUI screenview autocapture depends on our UIKit autocapture behavior. When a view controller appears, by way of a NavigationLink
, TabView
, or UIHostingController
, we detect its appearance and use the class name of the view controller along with the title text as the default data for labeling events.
For hybrid SwiftUI/UIKit apps and apps with distinct screen titles, this may provide enough information without code changes.
For pure SwiftUI apps, this may not be enough information, as SwiftUI may erase useful type information. Adding the csqScreenName view modifier alongside modifiers like navigationTitle or inside the view body will provide a stable name for the autocaptured screenview.
struct TransactionView: View {
let transaction: Transaction
var body: some View { ScrollView { ... } .navigationTitle("title-transaction") .csqScreenName("TransactionScreen") }}