Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnconfiguredExternalAccessory has no configure function #12

Open
jangelsb opened this issue Jul 7, 2023 · 1 comment
Open

UnconfiguredExternalAccessory has no configure function #12

jangelsb opened this issue Jul 7, 2023 · 1 comment

Comments

@jangelsb
Copy link

jangelsb commented Jul 7, 2023

Hello,

First of all, thank you for this great framework. I am trying to configure a UnconfiguredExternalAccessory and the documentation says to

// device is an UnconfiguredExternalAccessory gotten from Discovery
device
    .configure(on: viewController)
    .sink(receiveCompletion: { completion
        // Configuration has finished, either successfully or with an error
        switch completion {
        case .finished:
            // All good, user finished setting up this device
        case .failure(let error):
            switch error {
            case .cancelled:
                // User cancelled the flow
            case .failed:
                // Something failed during the process
            }
        }
    }, ...)

but there is no .configure(on:) function on UnconfiguredExternalAccessory and I can't find any reference to it in the code base.

I did see there is a UnconfiguredExternalAccessoryPublisher that takes a view controller. Are we supposed to use that?

Something like this?

UnconfiguredExternalAccessoryPublisher(browser: browser, unconfiguredExternalAccessory: device, viewController: visibleViewController)
.sink { completion in
    switch completion {
        case .finished:
            // All good, user finished setting up this device
            break
        case .failure(let error):
            switch error {
                case .cancelled:
                    // User cancelled the flow
                    break

                case .failed:
                    // Something failed during the process
                    break
            }
    }
    
} receiveValue: { _ in
    // never
}
.store(in: &subscriptions)
@melle
Copy link

melle commented Jul 13, 2023

@jangelsb Sorry for the late response. You're right, the documentation is outdated, using the UnconfiguredExternalAccessoryPublisher is the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants