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

Issue attempting to implement GARSessionDelegate in Swift #61

Open
kv-jw opened this issue Aug 26, 2022 · 1 comment
Open

Issue attempting to implement GARSessionDelegate in Swift #61

kv-jw opened this issue Aug 26, 2022 · 1 comment

Comments

@kv-jw
Copy link

kv-jw commented Aug 26, 2022

Hi all,

I'm attempting to use the latest release of the sdk in Swift, working with cloud anchors. When attempting to extend my anchor manager class and inherit from the GARSessionDelegate class, I get the following warning from Xcode:

Cannot declare conformance to 'NSObjectProtocol' in Swift; 'CloudAnchorManager' should inherit 'NSObject' instead

The only fix in this situation, to my knowledge, would be to implement the missing methods from the NSObjectProtocol. Is this intended functionality, or am I using this improperly? My current implementation looks like this:

extension CloudAnchorManager: GARSessionDelegate {
    
    func session(_ session: GARSession, didHost anchor: GARAnchor) {
        print("Anchor hosted successfully. Cloud ID: \(anchor.cloudIdentifier)")
        
        // Do something with hosted anchor here
    }
}

Would appreciate any feedback or insight with this, thanks!

@jrullman
Copy link

GARSessionDelegate is a protocol, not a class, so I think you need to make it a class and also extend from NSObject.

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