-
Notifications
You must be signed in to change notification settings - Fork 46
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
Fix issue 22 - ARSCNViewDelegate Handling Content Updates #25
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
In addition to the changes I requested, it'd be great if you added some example usages of these new protocol methods in the demo app.
MapboxARKit/AnnotationManager.swift
Outdated
@@ -7,6 +7,11 @@ import CoreLocation | |||
@objc optional func node(for annotation: Annotation) -> SCNNode? | |||
@objc optional func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) | |||
|
|||
@objc optional func MBRenderer(_ renderer: SCNSceneRenderer, time: TimeInterval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use s/MBRender/renderer in all of these new methods.
MapboxARKit/AnnotationManager.swift
Outdated
@@ -85,6 +90,19 @@ extension AnnotationManager: ARSCNViewDelegate { | |||
delegate?.session?(session, cameraDidChangeTrackingState: camera) | |||
} | |||
|
|||
|
|||
public func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { | |||
delegate?.MBRenderer!(renderer, time: time) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause a crash if the delegate is not nil but does not implement this method. This and all other calls should not force unwrap and should use optional chaining instead. MBRenderer
should be changed to renderer
here at the call site, too, after you make the change noted above.
Hello @boundsj, I have changed the implementation approach. |
class ViewController: UIViewController, ARSCNViewDelegate, AnnotationManagerDelegate {
... |
For review,
This is the solution that worked for me
#22
Cheers!