title: SwiftUI - How to Save selected Image to CoreData and Retrieve it from another View
body: <p>I'm using an image picker that allows the user to upload a profile picture. However I do not know how to save the image after its selected. This is the image picker code I'm using. Once saved I would also like to retrieve the image in another view and display it.</p>
  <pre><code>image!
      .resizable()
      .aspectRatio(contentMode: .fill)
      .frame(width: 150, height: 150)
      .clipShape(Circle())
      .overlay(Circle().stroke(Color.white, lineWidth: 4))
      .shadow(radius: 10)
      .onTapGesture { self.shouldPresentActionScheet = true }
      .sheet(isPresented: $shouldPresentImagePicker) {
          SUImagePickerView(sourceType: self.shouldPresentCamera ? .camera : .photoLibrary, image: self.$image, isPresented: self.$shouldPresentImagePicker)
      }.actionSheet(isPresented: $shouldPresentActionScheet) { () -&gt; ActionSheet in
          ActionSheet(title: Text(&quot;Choose mode&quot;), message: Text(&quot;Please choose your preferred mode to set your profile image&quot;), buttons: [ActionSheet.Button.default(Text(&quot;Camera&quot;), action: {
              self.shouldPresentImagePicker = true
              self.shouldPresentCamera = true
          }), ActionSheet.Button.default(Text(&quot;Photo Library&quot;), action: {
              self.shouldPresentImagePicker = true
              self.shouldPresentCamera = false
          }), ActionSheet.Button.cancel()])
          
      }
  </code></pre>