1

I've created a UIViewControllerRepresentable wrapper for the IASKAppSettingsViewController so I can use it with my SwiftUI Project.

It worked fine for a Toggle Switch but when I attempted a PSMultiValueSpecifier, my view did not transition to the screen with the multiple values.

Below is my wrapper:

import SwiftUI
import UIKit
import InAppSettingsKit

struct SettingsView: UIViewControllerRepresentable {
    typealias UIViewControllerType = IASKAppSettingsViewController
    
    func makeUIViewController(context: UIViewControllerRepresentableContext<SettingsView>) -> IASKAppSettingsViewController {
        return IASKAppSettingsViewController()
    }

    func updateUIViewController(_ uiViewController: IASKAppSettingsViewController, context: UIViewControllerRepresentableContext<SettingsView>) {
        
    }
}

This is the configuration (from the sample app) that is not working:

        <dict>
            <key>Type</key>
            <string>PSMultiValueSpecifier</string>
            <key>Title</key>
            <string>Multi Value with a long title</string>
            <key>Key</key>
            <string>multivalue_long</string>
            <key>DefaultValue</key>
            <integer>2</integer>
            <key>Values</key>
            <array>
                <integer>1</integer>
                <integer>2</integer>
                <integer>3</integer>
            </array>
            <key>Titles</key>
            <array>
                <string>One</string>
                <string>Two</string>
                <string>Three</string>
            </array>
        </dict>

Note: I didn't see any errors, just tapping on the screen did not transition to allow me to select values.

app_dev55
  • 31
  • 4

1 Answers1

2

I found the issue:

The SettingsView needed to be wrapped in a NavigationView like the below:

NavigationView { SettingsView() }

This fixed the issue where the multiple values screen wasn't showing up.

app_dev55
  • 31
  • 4
  • 2
    If you'd be willing to open source a Swift UI sample project for IASK, that would be awesome, I'm the lead dev of IASK and would be happy to accept a pull request or link to an IASK sample project of yours from the Readme. – Ortwin Gentz Nov 02 '20 at 10:39