Drone#

Code samples in the camera section refer to a Drone object.

Here is the sample code to initialize this Drone object:

/// Current drone instance.
private var drone: Drone?

override func viewDidLoad() {
    autoConnectionRef = groundSdk.getFacility(Facilities.autoConnection) { [weak self] autoConnection in

        // Called when the auto connection facility is available and when it changes.
        if let self = self, let autoConnection = autoConnection {
            // Start auto connection.
            if (autoConnection.state != AutoConnectionState.started) {
                autoConnection.start()
            }

            self.drone = autoConnection.drone
        }
    }
}

A complete implementation of the camera is also available in GroundSdkDemo here.