AVCaptureMetadataOutputObjectsDelegate not called in swift 4 for QR scanner

Okay I've found an update here.

Found that AVCaptureMetadataOutputObjectsDelegate method is changed

from

captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!)

to

metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection)

After changing this delegate method, its working good now.