What is the difference between extension and adding protocols to class decleration?

For example what is the difference between these two pieces of code?

extension SelfieListViewController : UIImagePickerControllerDelegate, UINavigationControllerDelegate
{
}


Vs


class SelfieListViewController: UITableViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

Replies

In the second one you extend the SelfieListViewControllerclass, but only if this class (or subclass) implements a specified protocol, based on.

There is little difference.


However, init is not done exactly in the same way.


Read this other thread

https://forums.developer.apple.com/thread/112217