When I try this I get error:
class ViewController: UIViewController, UIScrollViewDelegate {
......
}
extension ViewController: UIScrollViewDelegate
The error is self-explaining. You don't have to conform to a protocol multiple times. You can either do 1)
class ViewController: UIViewController, UIScrollViewDelegate {
......
}
or
2)
class ViewController: UIViewController {
......
}
extension ViewController: UIScrollViewDelegate { // No error
...
}
In case 1, you don't need an extension because the class itself adopts the protocol. The purpose of the extension is to add more functionality to the class. In case 2, it is clear that the extension adopts to the protocol.