title: SWIFTUI warning imagePickerController nearly matches - happens only in existing swift project file
body: <p>I'm upgrading an existing app with some swift views. Now I'm getting the warning:</p>
  <blockquote>
  <p>Instance method 'imagePickerController(<em>:didFinishPickingMediaWithInfo:)' nearly matches optional requirement 'imagePickerController(</em>:didFinishPickingMediaWithInfo:)' of protocol 'UIImagePickerControllerDelegate'</p>
  </blockquote>
  <p>at the function:</p>
  <pre><code>public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
          if let image = info[.originalImage] as? UIImage {
              self.onImagePicked(image)
          }
         
          self.onDismiss()
      }
  </code></pre>
  <p>Additionally I get the error message:</p>
  <blockquote>
  <p>Cannot infer contextual base in reference to member 'originalImage'</p>
  </blockquote>
  <p>The funny thing is, if I copy the code in a new project everything is fine (no warning, no error). In order to check whether I may have some effects from other views/methods within the existing project, I copied my existing project and deleted all other files, except the one with the imagepicker - still the warning and the error.</p>
  <p>Is there any setup or other issue which might be the reason? Any help is more than appreciated - working on that the third day now ....</p>
  <p>The whole code is:</p>
  <pre><code>import SwiftUI
  
  public struct ImagePickerView: UIViewControllerRepresentable {
  
      private let sourceType: UIImagePickerController.SourceType
      private let onImagePicked: (UIImage) -&gt; Void
      @Environment(\.presentationMode) private var presentationMode
  
      public init(sourceType: UIImagePickerController.SourceType, onImagePicked: @escaping (UIImage) -&gt; Void) {
          self.sourceType = sourceType
          self.onImagePicked = onImagePicked
      }
  
      public func makeUIViewController(context: Context) -&gt; UIImagePickerController {
          let picker = UIImagePickerController()
          picker.sourceType = self.sourceType
          picker.delegate = context.coordinator
          return picker
      }
  
      public func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {}
  
      public func makeCoordinator() -&gt; Coordinator {
          Coordinator(
              onDismiss: { self.presentationMode.wrappedValue.dismiss() },
              onImagePicked: self.onImagePicked
          )
      }
  
        public class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
  
          private let onDismiss: () -&gt; Void
          private let onImagePicked: (UIImage) -&gt; Void
  
          init(onDismiss: @escaping () -&gt; Void, onImagePicked: @escaping (UIImage) -&gt; Void) {
              self.onDismiss = onDismiss
              self.onImagePicked = onImagePicked
          }
          
           public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
              if let image = info[.originalImage] as? UIImage {
                  self.onImagePicked(image)
              }
              print(&quot;vor dismiss&quot;)
              self.onDismiss()
          }
          
          public func imagePickerControllerDidCancel(_: UIImagePickerController) {
              self.onDismiss()
          }
  
      }
  
  }
  </code></pre>
  <p>The project Format is Xcode 12.0-compatible, iOS Deployment Target is 14.0,
  The project includes originally also watch</p>