ios – utilizing qualtrics in a SwiftUI app with a UIViewControllerRepresentable


I am making an attempt to make a easy swiftui app utilizing qualtrics and I am making an attempt to make use of a uiviewrepresentable to make it work

struct QualtricsViewRep: UIViewControllerRepresentable {

typealias UIViewControllerType = UIViewController

func makeUIViewController(context: Context) -> UIViewController {
    let vc = UIViewController()
    Qualtrics.shared.evaluateProject { (targetingResults) in
        for (interceptID, outcome) in targetingResults {
            if outcome.handed() {
                let displayed = Qualtrics.shared.show(viewController: self, autoCloseSurvey: true)
            }
        }
    }
}

on let displayed = … I maintain getting the error “Can not convert worth of sort ‘QualtricsViewRep’ to anticipated argument sort ‘UIViewController'”, how can I return this code as a UIViewController to make use of in a swiftui app, or is there another approach I needs to be approaching this?

Leave a Reply