Essentially I would like to enable a shadow radius below the navigation bar once the user begins to scroll. The navigation bar resides in a TableView controller, when the view controller is first opened the navigation controller should be in its normal state but once the user begins to scroll the shadow appears.
The following is the code I have so far for creating the shadow below the navigation bar:
//Adds Shadow below navigation bar
self.navigationController?.navigationBar.layer.masksToBounds = false
self.navigationController?.navigationBar.layer.shadowColor = UIColor.lightGray.cgColor
self.navigationController?.navigationBar.layer.shadowOpacity = 0.8
self.navigationController?.navigationBar.layer.shadowOffset = CGSize(width: 0, height: 2.0)
self.navigationController?.navigationBar.layer.shadowRadius = 2
How can it be enabled only when user begins to scroll?